簡體   English   中英

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

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM