使用“开始"带有传递给启动程序的参数的命令 [英] Using the "start" command with parameters passed to the started program
问题描述
我在 Virtual PC 2007 中有一个虚拟机.
I have a Virtual Machine in Virtual PC 2007.
要从桌面启动它,我在批处理文件中有以下命令:
To start it from the desktop, I have the following command in a batch file:
"c:program filesMicrosoft Virtual PCVirtual PC.exe" -pc "MY-PC" -launch
但这会在主机上留下一个 dos 提示,直到虚拟机关闭,然后我退出 Virtual PC 控制台.真烦人.
But that leaves a dos prompt on the host machine until the virtual machine shuts down, and I exit out of the Virtual PC console. That's annoying.
所以我将命令改为使用 START 命令:
So I changed my command to use the START command, instead:
start "c:program filesMicrosoft Virtual PCVirtual PC.exe" -pc MY-PC -launch
但它会因传递给 Virtual PC 的参数而窒息.
But it chokes on the parameters passed into Virtual PC.
START/?
表示参数确实在那个位置.有没有人使用 START 启动带有多个命令行参数的程序?
START /?
indicates that parameters do indeed go in that location. Has anyone used START to launch a program with multiple command-line arguments?
推荐答案
START 有一个特殊性,涉及第一个参数周围的双引号.如果第一个参数有双引号,它将用作新窗口的可选 TITLE.
START has a peculiarity involving double quotes around the first parameter. If the first parameter has double quotes it uses that as the optional TITLE for the new window.
我相信你想要的是:
start "" "c:program filesMicrosoft Virtual PCVirtual PC.exe" -pc MY-PC -launch
换句话说,在程序名称之前给它一个空的标题来伪装它.
In other words, give it an empty title before the name of the program to fake it out.
这篇关于使用“开始"带有传递给启动程序的参数的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!