问题
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