Page 1 of 1

script to read a text file

Posted: 22 Jun 2008 18:47
by noed98
Can you kindly help me to solve a problem to create a batch command/file that able to read two strings from a text file?
I have text file called input.txt contains
string1 string2

and I have execution file called update.exe
I would like to create a batch file/command that able to read the string from input.txt and executed using the the update.exe
eg. uppdate.exe string1 string2

it doesn't need to be a loop.
Much appreciated.


Posted: 26 Jun 2008 01:45
by psinetic

there is a command:


which can type to you all the info in a text, bat, or vbs file. now, you can use:

type "your file" >> "yourotherfile".bat/txt/vbs

and if you really wanna get tricky, you can use something like this:

Code: Select all

@echo off
echo This is so cool v 1.0
echo Are there any codes you wish to add to this file? (y/n)
set /p answer=
if %answer%==y goto yes
if %answer%==n goto no
echo Which file? (please type location and name of file)
set /p file=
type %file% >> %0
goto run

be noted that the SPACE at the end of the code is there for a reason. at :run, it will run whatever code you add to the file.

you can also use the "find" command to search a text or document for a specific string. I haven't fully found out how to use "find" though :P

Posted: 30 Jun 2008 04:50
by Thebetr1
tell me if this is what you want

Code: Select all


set /p arg=<"input.txt"
start "" "update.exe" %arg%