[英]How to run multiple commands in one batch file?
我想在一个批处理文件中运行多个命令。
我尝试了 &、&&、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
C:\Windows\System32\cmd.exe /k <command>
在执行的地方启动一个新的 cmd 上下文,但/k
保持该新上下文打开。 您想在执行后关闭它,以便可以执行来自原始上下文的更多命令。 使用/c
而不是/k
来做到这一点。
cmd /?
好吧,批处理脚本默认已经这样做了,但我猜你在 cmd.exe 上使用 /K 是不必要和有害的,即使 A / C 可以完成这项工作,记住,它没有必要。
文件1.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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.