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

问题描述 投票:10回答:2

以下命令有什么区别:

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

我需要script.cmd的cmd窗口在script.cmd完成时自动关闭。

windows batch-file cmd
2个回答
15
投票

%comspec%只指向cmd.exe,因此两个命令都会执行相同的操作。除了/C是正确的,这将在执行后关闭命令提示符


-1
投票

对于WindowsXP-SP2上的非管理员用户。

  • %comspec%以%WINDIR%\ System32开头。
  • 'cmd'在用户家中开始,例如C:\ Document And Settings \ USER1。
© www.soinside.com 2019 - 2024. All rights reserved.