2015-09-23 62 views
-1

我想在一個批處理文件中運行多個命令。如何在一個批處理文件中運行多個命令?

我試過了&,& &,開始,/等待,調用,:開始和結束開始命令,但沒有運氣。

這裏是我的命令:

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

不確定你的意思 - 是不是那些多個命令?你的意思是在同一時間嗎? –

+0

是的,當你雙擊它或以管理員身份運行它時,cmd並不想全部運行,但它只運行第一個。 –

+0

僅運行第一行?參見'cmd /?'。請特別注意'/ k'與'/ c' – Stephan

回答

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

開始執行,其中一個新的CMD範圍內,但/k保持新的背景下開放。您想在執行後關閉它,以便可以執行來自原始上下文的更多命令。使用/c而不是/k來這樣做。

描述在cmd /?

+0

謝謝,但我管理,但它仍然是很好的瞭解其他事情。 –

+0

我的代碼現在看起來像這樣。也許有任何意見? –

相關問題