How to run multiple commands in one batch file?

£可爱£侵袭症+ 提交于 2021-02-17 06:15:07

问题


I want to run multiple commands in one batch file.

I tried the &, &&, start, /wait, call, :begin and goto begin commands but no luck.

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

回答1:


C:\Windows\System32\cmd.exe /k <command>

starts a new cmd context where is executed, but /k keeps that new context open. 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.

described in cmd /?



来源:https://stackoverflow.com/questions/32733567/how-to-run-multiple-commands-in-one-batch-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!