如何获得两个或多个命令连成一个批处理文件 [英] How to get two or more commands together into a batch file
本文介绍了如何获得两个或多个命令连成一个批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想达到一个特定的位置后,进入命令提示符的命令。我怎样才能做到这一点?
例如,
集的PathName =X:\\ Web内容管理\\完成过滤\\ 2013_Folder
集COMD =DIR / B / S * .ZIP
启动CMDCD / D%路径;%
我打开命令提示符下使用的PathName
给它一个路径。现在,实现这一特定的路径后,我想将 COMD
变量插入命令提示符下,得到期望的结果。
这是我想在批处理文件来执行的特定命令:
的Microsoft Windows [版本6.1.7601]
版权所有(c)2009年微软公司。版权所有。
C:\\用户\\ anoopn> X:
X:\\> CD
X:\\ Web内容管理\\完成过滤\\ 2013_Folder
X:\\ Web内容管理\\完成过滤\\ 2013_Folder> DIR / B / S * .zip文件> C:\\用户\\ anoopn \\桌面\\ abc.csv
解决方案
要获取用户输入:
设定/ p pathName将=输入值:%=%
@echo%路径;%
P.S。这也是正确的:
设定/ p pathName将=输入值:
I want to enter a command in command prompt after reaching a specific location. How can I achieve this?
e.g.,
set PathName="X:\Web Content Mgmt\Completed Filtering\2013_Folder"
set comd="dir /b /s *.zip"
start "cmd" cd /d %PathName%
I am opening the command prompt and giving it a path using PathName
. Now after reaching that specific path I want to insert the comd
variable into the command prompt to get the desired result.
These are the specific commands I am trying to execute in the batch file:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\anoopn>x:
X:\>cd
X:\Web Content Mgmt\Completed Filtering\2013_Folder
X:\Web Content Mgmt\Completed Filtering\2013_Folder> dir /b /s *.zip > C:\Users\anoopn\Desktop\abc.csv
解决方案
To get a user Input :
set /p pathName=Enter The Value:%=%
@echo %pathName%
p.s. this is also valid :
set /p pathName=Enter The Value:
这篇关于如何获得两个或多个命令连成一个批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文