Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch: data from several txt files

Status
Not open for further replies.

Xypriz

Technical User
Oct 30, 2002
6
NL
All,

I want to make a batch file which looks into a certain directory for *.txt files. In these *.txt files a computer hostname is mentioned, which should be read as a variable for a command.

So far I have got this:

FOR /F %%i IN (c:\txt\test.txt) DO psexec %%i -c c:\reg.bat

This works, but only for the "test.txt" file. I want to make it work for ALL txt files in the specified directory. When I replace (c:\txt\test.txt) with (c:\txt\*.txt) it doesn't work. It says that it cannot find "*.txt" (thinking *.txt is the file name).

I tried utilities like FORTUNE and FORALL but I don't really understand how to get it working in this case.

Can anyone help me?

Thnx in advance...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top