在基于Wix 的安装程序制作中,需要执行一个批处理,而这个批处理内部调用了一个exe命令。
起初,是这么写的,
start file.exe parameters_for_file
后来,为了解决一个file.exe具体路径的问题,我在批处理文件的开头加上了
set cur_dir=%~dp0
然后,企图用绝对路径代替对当前目录的假设:
start "%cur_dir%file.exe" parameters_for_file
为了对付可能含有空格的路径, 我用了双引号,
但这个看似无懈可击的办法,在最终安装时却失败了,提示说找不到 parameters_for_title,为什么?系统把它当作了可执行文件。而"%cur_dir%file.exe" 却被当作了窗口的title.
start /?
结果是:
Starts a separate window to run a specified program or command.
START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
[/AFFINITY ] [/WAIT] [/B] [command/program]
[parameters]
"title" Title to display in window title bar.
path Starting directory
B Start application without creating a new window. The
application has ^C handling ignored. Unless the application
enables ^C processing, ^Break is the only way to interrupt
the application
I The new environment will be the original environment passed
to the cmd.exe and not the current environment.
MIN Start window minimized
MAX Start window maximized
SEPARATE Start 16-bit Windows program in separate memory space
SHARED Start 16-bit Windows program in shared memory space
LOW Start application in the IDLE priority class
NORMAL Start application in the NORMAL priority class
HIGH Start application in the HIGH priority class
REALTIME Start application in the REALTIME priority class
ABOVENORMAL Start application in the ABOVENORMAL priority class
BELOWNORMAL Start application in the BELOWNORMAL priority class
AFFINITY The new application will have the specified processor
affinity mask, expressed as a hexadecimal number.
WAIT Start application and wait for it to terminate
command/program
If it is an internal cmd command or a batch file then
the command processor is run with the /K switch to cmd.exe.
This means that the window will remain after the command
has been run.
If it is not an internal cmd command or batch file then
it is a program and will run as either a windowed application
or a console application.
parameters These are the parameters passed to the command/program
这种违反直观的命令设计,真得很小心的避让它的陷阱,不得不说,微软的命令行设计,真的很垃圾。
阅读(1320) | 评论(0) | 转发(0) |