“start %comspec% /c script.cmd” vs “start cmd /C s

2019-04-21 06:16发布

What is the difference between following commands:

start %comspec% /c script.cmd
start cmd /C script.cmd

I need that cmd window for script.cmd should close automatically when script.cmd is finished.

2条回答
成全新的幸福
2楼-- · 2019-04-21 06:34

%comspec% just points to cmd.exe, so both commands will do the same thing. Other than that /C is correct, this will close the command prompt after execution

查看更多
在下西门庆
3楼-- · 2019-04-21 06:44

For a not admin user on WindowsXP-SP2.

  • %comspec% starts in %WINDIR%\System32.
  • 'cmd' starts in user's home e.g. C:\Document And Settings\USER1.
查看更多
登录 后发表回答