简体   繁体   English

如何在一个批处理文件中运行多个命令?

[英]How to run multiple commands in one batch file?

I want to run multiple commands in one batch file.我想在一个批处理文件中运行多个命令。

I tried the &, &&, start, /wait, call, :begin and goto begin commands but no luck.我尝试了 &、&&、start、/wait、call、:begin 和 goto begin 命令,但没有运气。

Here are my commands:这是我的命令:

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>

starts a new cmd context where is executed, but /k keeps that new context open.在执行的地方启动一个新的 cmd 上下文,但/k保持该新上下文打开。 You want to close it after executing , so further commands from the original context can be executed.您想在执行后关闭它,以便可以执行来自原始上下文的更多命令。 Use /c instead of /k to do so.使用/c而不是/k来做到这一点。

described in cmd /? cmd /?

Well, batch scripts already do it by default, but i guess that your usage of /K on cmd.exe it was unnecessary and harmful, and A / C could have done the job even though, remembering, it is not necessary.好吧,批处理脚本默认已经这样做了,但我猜你在 cmd.exe 上使用 /K 是不必要和有害的,即使 A / C 可以完成这项工作,记住,它没有必要。

File1.bat *文件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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM