如何在一个批处理文件中运行多个命令? [英] How to run multiple commands in one batch file?

查看:51
本文介绍了如何在一个批处理文件中运行多个命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一个批处理文件中运行多个命令.

我尝试了& ;、&& ;、开始,/wait,调用,:begin和goto begin命令,但是没有运气.

这是我的命令:

  C:\ Windows \ System32 \ cmd.exe/k%windir%\ System32 \ reg.exe添加HKLM \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Policies \ System/v EnableLUA/t REG_DWORD/d 0/Fsc config remoteregistry start =自动sc启动远程注册表sc配置计划开始=自动sc开始时间表sc停止McAfeeFrameworksc配置McAfeeFramework启动=禁用sc停止McShieldsc配置McShield启动=禁用sc停止McTaskManagersc配置McTaskManager启动=禁用netsh advfirewall将AllProfiles状态设置为关闭sc停止MpsSvcsc config MpsSvc start =禁用 

解决方案

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

启动一个新的cmd上下文并在其中执行,但是/k 使该新上下文保持打开状态.您想在执行后关闭它,以便可以执行原始上下文中的其他命令.使用/c 代替/k .

cmd/?

中描述的

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

解决方案

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 /?

这篇关于如何在一个批处理文件中运行多个命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆