从.bat文件执行多个命令 [英] Execute Multiple commands from a .bat file

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

问题描述

我需要一些帮助来在cmd提示符下从.bat文件执行多个命令.
例如我正在执行一个exe:

 D:
光盘\
cd"D:\ AWD_NT \ BIN"

USERIDMGREX.EXE awd.ini 



我面临的问题是,我需要在同一"USERIDMGREX.EXE" .exe中再执行2个命令.

我需要运行的命令是:

"dumpids"和"delid" ...和"delid"采用另一个参数,例如美味的TMOODLEY".这些需要在以上相同的exe中执行("USERIDMGREX.EXE").

任何帮助将不胜感激.从问题中还不清楚

USERIDMGREX.EXE的工作原理.如果它是一个显示自己的提示并等待用户键入输入的程序,则可以从文件中重定向标准输入.使用命令处理器本身和一个文本文件(每行包含一个命令)最容易说明这一点.

例如commands.txt

echo Display system time and date
time /t
date /t



在命令提示符下,我们可以发出命令

e:>cmd < commands.txt



并查看输出

e:> cmd < commands.txt
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

e:>echo Displaying time and date
Displaying time and date

e:>time /t
10:55

e:>date /t
11/11/2011



USERIDMGREX.EXE可能以相同的方式响应重定向的输入
例如commands.txt

dumpids
delid TMOODLEY




USERIDMGREX awd.ini < commands.txt



艾伦.


如果您的 .exe 程序不接受参数,则需要查看代码.更改 .bat 文件的布局不会有任何区别.


Hi , I need some assistance to execute multiple commands from a .bat file on a cmd prompt.
e.g. I am executing an exe :

D:
cd \
cd "D:\AWD_NT\BIN"

USERIDMGREX.EXE awd.ini



The problem I am facing is that I need to execute 2 more commands after that in the same "USERIDMGREX.EXE" .exe.

the commands i need to run are :

"dumpids" and "delid" ... and "delid" takes another parameter , e.g. "delid TMOODLEY". These need to be executed in the same exe above("USERIDMGREX.EXE").

Any help would be greatly appreciated. thanks

解决方案

How USERIDMGREX.EXE works is not clear from the question. If it is a program that displays it''s own prompt and waits for the user to type an input then it may be possible to redirect standard input from a file. This is most easily demonstrated with the command processor itself and a text file containing one command per line.

e.g. commands.txt

echo Display system time and date
time /t
date /t



At a command prompt we can issue the command

e:>cmd < commands.txt



and see the output

e:> cmd < commands.txt
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

e:>echo Displaying time and date
Displaying time and date

e:>time /t
10:55

e:>date /t
11/11/2011



USERIDMGREX.EXE may respond to redirected input in the same manner
e.g. commands.txt

dumpids
delid TMOODLEY



and

USERIDMGREX awd.ini < commands.txt



Alan.


If your .exe program is not accepting parameters then you need to look at the code. Changing the layout of the .bat file will not make any difference.


这篇关于从.bat文件执行多个命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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