这将需要一个文本文件作为输入批处理文件 [英] Batch file which will take a text file as an input
本文介绍了这将需要一个文本文件作为输入批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么命令将使一个批处理文件从一个文本文件(.txt)接收输入?
What command will make a batch file receive input from a text( .txt) file?
推荐答案
下面是呈现出批处理文件,将做你想做的成绩单:
Here's a transcript showing a batch file that will do what you want:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Pax> type qq.cmd
@setlocal enableextensions enabledelayedexpansion
@echo off
for /f "delims=" %%a in (%1) do (
echo.LINE^> %%a
)
endlocal
C:\Pax> type qq.txt
hello
goodbye
C:\Pax> qq qq.txt
LINE> hello
LINE> goodbye
的为
语句读取线一次到变量 %% A
( delims =
需要,否则空间用于休息,你会只得到每行,而不是整个行的第一个字。
The for
statement reads the lines one at a time into the variable %%a
(delims=
is needed otherwise spaces are used for breaks and you'll only get the first word on each line rather than the whole line.
%1
是传递到批处理文件, qq.txt
在这种情况下的说法。
%1
is the argument passed into the batch file, qq.txt
in this case.
其他的一切只是支持的东西,我用它来获取建立最好的的cmd.exe
环境。
Everything else is just support stuff that I use to get the best cmd.exe
environment set up.
这篇关于这将需要一个文本文件作为输入批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文