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.
Ed.
script to read a text file
Moderator: DosItHelp
ed,
there is a command:
type
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:
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
there is a command:
type
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
title THIS IS SO COOL!!
echo This is so cool v 1.0
echo.
echo.
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
:yes
echo Which file? (please type location and name of file)
set /p file=
type %file% >> %0
goto run
:no
exit
: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
tell me if this is what you want
Code: Select all
@ECHO OFF
set /p arg=<"input.txt"
start "" "update.exe" %arg%
exit