VB.NET 从 2 个快捷方式调用桌面应用程序 - 提供不同的参数

发布于 2024-09-12 21:00:26 字数 132 浏览 14 评论 0原文

我有一个桌面应用程序,它从指定的文件夹中读取文件,然后根据用户提供的标准将文件存储到第三方文档管理系统中的文件夹中。

我的问题是:

是否可以以某种方式为代码提供不同的参数,具体取决于用户单击启动应用程序的哪个快捷方式?

I have a desktop application which reads files from a specified folder, then deposits the files to a folder in a third party document management system based on criteria that the user provides.

My question is:

is it possible to somehow provide different parameters to the code, depending on which shortcut of the application the user clicked on to start it up?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我偏爱纯白色 2024-09-19 21:00:26

您可以将命令行参数添加到快捷方式图标。以下是在 Windows 中执行此操作的方法:

  • 在“开始”菜单上,导航到记事本。
  • 右键单击记事本并选择发送到>桌面(创建快捷方式)
  • 右键单击新创建的桌面图标,然后选择“属性”
  • 将命令行参数添加到“目标”文本框中。

    • 例如,如果您希望记事本打开hosts文件,则Target属性的内容如下:

      <块引用>

      %SystemRoot%\system32\notepad.exe "C:\WINDOWS\system32\drivers\etc\hosts"

您可以将几乎任何内容放入要放入命令行的快捷方式的 Target 属性中。

You can add command line parameters to a shortcut icon. Here's how you can do it in Windows:

  • On the Start Menu, navigate to Notepad.
  • Right click on Notepad and choose Send To > Desktop (Create Shortcut)
  • Right click on the newly-created desktop icon and choose Properties
  • Add your command line parameters to the Target text box.

    • For example, if you want notepad to open up the hosts file, this would be the content of Target property:

      %SystemRoot%\system32\notepad.exe "C:\WINDOWS\system32\drivers\etc\hosts"

You can put pretty much anything into the Target property of a shortcut that you would put into a command line.

牛↙奶布丁 2024-09-19 21:00:26

是的。

最简单的方法是让快捷方式通过命令行传递这些参数。

Yes.

The easiest way would be to have the shortcut pass those parameters in via the command line.

廻憶裏菂餘溫 2024-09-19 21:00:26

您还可以使用条件编译变量,并拥有 2 个不同的 .exe。您应该能够在帮助中找到这两种方法(命令行和条件编译变量)的示例。

You could also use conditional compilation variables, and have 2 different .exes. You should be able to find samples of both approaches (command line and conditional compilation variable) in help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文