如何从命令行使用参数启动存储在 UNC 共享上的程序?
我们使用一个内部程序,它存储在 UNC 共享上,因此更新是透明的。 我想向它提供一些命令行参数,如下所示:
\\server\share\in_house_thingy.exe myusername mypassword
但我似乎无法让它在 CMD 或 PowerShell 中或通过快捷方式工作。
有人有什么想法吗?
There's an in-house program we use and it's stored on a UNC share so that updates are transparent. I'd like to supply it some command line parameters like so:
\\server\share\in_house_thingy.exe myusername mypassword
But I can't seem to get it to work in either CMD or PowerShell or via a shortcut.
Anyone got any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以使用:
如果您想从该进程获取退出代码或其他信息,$process 对象将为您提供一个实时进程对象。
You could use:
The $process object will give you a live process object if you want to get an exit code or other information from that process.
对于快捷方式,将目标更改为:
除非您确实想要使用 powershell 来完成此操作。
For a shortcut, change the target to be like:
unless you really do want to have to use powershell to make this work.
在批处理文件中使用
%~dp0
作为当前 (unc) 路径,包括powershell 脚本中的尾随
\
将此用于当前 (unc) 路径,不带尾随\
use
%~dp0
in a batch file for the current (unc) path including the trailing\
in a powershell script use this for the current (unc) path without trailing
\
我刚刚注意到有一个 .CMD 文件将文件从共享复制到临时目录并在本地运行。
如果没有更好的解决方案,你们都可以投票赞成这个答案,那就行了。
I just noticed that there's a .CMD file that's copying the file from the share to the temp directory and running it locally.
If y'all could just vote this answer up if there's no better solution, that'll work.