如何将两个或更多的命令集中到一个批处理文件中 [英] How to get two or more commands together into a batch file

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

问题描述

我想在到达特定位置后在命令提示符中输入命令。

 设置PathName = 

X:\Web Content Mgmt\Completed Filtering\2013_Folder
set comd =dir / b / s * .zip
startcmdcd / d%PathName%

我打开命令提示符,并使用 PathName 。现在到达该特定路径后,我想将 comd 变量插入命令提示符以获取所需的结果。



这些是我试图在批处理文件中执行的特定命令:

  Microsoft Windows [版本6.1.7601] 
版权所有(c)2009 Microsoft Corporation。版权所有。
C:\Users\anoopn> x:
X:\> cd
X:\ Web内容Mgmt \Completed筛选\2013_Folder
X: \Web Content Mgmt\Completed Filtering \2013_Folder> dir / b / s * .zip> C:\Users\anoopn\Desktop\abc.csv


解决方案

要获取用户输入:

  set / p pathName = Enter值:%=%
@echo%pathName%



ps这也是有效的:



set / p pathName = Enter值:


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屋!

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