我想在一个批处理文件中运行多个命令。
我尝试了&,&&,start,/ wait,call,:begin和goto begin命令,但没有运气。
以下是我的命令:
C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f
sc config remoteregistry start= auto
sc start remoteregistry
sc config Schedule start=auto
sc start Schedule
sc stop McAfeeFramework
sc configure McAfeeFramework startup= disabled
sc stop McShield
sc configure McShield startup= disabled
sc stop McTaskManager
sc configure McTaskManager startup= disabled
netsh advfirewall set AllProfiles state off
sc stop MpsSvc
sc config MpsSvc start= disabled
答案 0 :(得分:1)
C:\Windows\System32\cmd.exe /k <command>
启动执行的新cmd上下文,但/k
保持新上下文打开。您希望在执行后关闭它,因此可以执行原始上下文中的其他命令。使用/c
代替/k
来执行此操作。
在cmd /?
答案 1 :(得分:0)
好吧,默认情况下批处理脚本已经这样做了,但是我猜您在 cmd.exe 上使用 /K 是不必要且有害的,即使 A / C 可以完成这项工作,请记住,这不是必需的.
File1.bat*
C:\Windows\System32\cmd.exe /c %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f
sc config remoteregistry start= auto
sc start remoteregistry
sc config Schedule start=auto
sc start Schedule
sc stop McAfeeFramework
sc configure McAfeeFramework startup= disabled
sc stop McShield
sc configure McShield startup= disabled
sc stop McTaskManager
sc configure McTaskManager startup= disabled
netsh advfirewall set AllProfiles state off
sc stop MpsSvc
sc config MpsSvc start= disabled