VB.NET 从 2 个快捷方式调用桌面应用程序 - 提供不同的参数
我有一个桌面应用程序,它从指定的文件夹中读取文件,然后根据用户提供的标准将文件存储到第三方文档管理系统中的文件夹中。
我的问题是:
是否可以以某种方式为代码提供不同的参数,具体取决于用户单击启动应用程序的哪个快捷方式?
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以将命令行参数添加到快捷方式图标。以下是在 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:
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:
You can put pretty much anything into the Target property of a shortcut that you would put into a command line.
是的。
最简单的方法是让快捷方式通过命令行传递这些参数。
Yes.
The easiest way would be to have the shortcut pass those parameters in via the command line.
您还可以使用条件编译变量,并拥有 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.