简体   繁体   English

如何从命令提示符处执行连续的命令?

[英]How can I execute consecutive commands from a command prompt?

How can I execute two consecutive commands on the command line with the help of wshshell.exec or wshshell.run in vbscript? 如何在vbscript中的wshshell.execwshshell.run的帮助下在命令行上执行两个连续的命令? For example I need to execute cd C:\\a and then winzip32.exe -min -a D:\\a . 例如,我需要执行cd C:\\a然后执行winzip32.exe -min -a D:\\a

You can do something like cd C:\\a & winzip32.exe -min -a D:\\a where the & separates commands so the that second one runs once the first has finished successfully. 您可以执行cd C:\\a & winzip32.exe -min -a D:\\a ,其中&分隔命令,以便第二个命令在第一个命令成功完成后运行。 For example, you could run it like this: 例如,您可以这样运行它:

Set oExec = WshShell.Exec("cmd /c cd C:\a & winzip32.exe -min -a D:\a")

Without the cmd /c in the beginning, you can't do things like cd because cmd.exe is responsible for processing the cd and & . 开始时没有cmd /c ,您将无法执行cd因为cmd.exe负责处理cd&

根据您的操作,可以使用WshShell.Exec“ c:\\ a \\ winzip32.exe -min -a D:\\ a”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Windows(7)命令提示符中导出命令的历史记录? - How I can export the history of my commands in Windows(7) Command Prompt? 在Java中执行命令提示符命令 - Execute command prompt commands in java 如何从python执行命令提示符命令 - How to execute a command prompt command from python 如何在Windows命令提示符下创建和执行完整命令的文件? - How to create and execute a file full of commands on Windows command prompt? 如何在命令提示符下在浏览器中执行JavaScript - How to execute JavaScript in a browser from the command prompt 如何通过命令提示符(从文本文件)提供多个命令 - How to feed multiple commands (from a text file) through command prompt PowerShell:如何从PowerShell以管理员身份运行远程命令提示符命令? - PowerShell : How to run remote command prompt commands as admin from PowerShell? 命令提示符:从任何文本文件执行命令(没有“.bat”或“.cmd”扩展名) - Command Prompt: Execute Commands from Any Text File (Not Having “.bat” or “.cmd” Extensions) 如何用Java在Windows中的一个命令中执行多个命令和psql查询? - How can I execute multiple commands and psql queries in one command for Windows in Java? Powershell中的批处理文件命令在其他命令提示符下执行 - batch file commands in powershell execute in a different command prompt
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM