script to read a text file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
noed98
Posts: 1
Joined: 22 Jun 2008 18:31

script to read a text file

#1 Post by noed98 » 22 Jun 2008 18:47

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.

psinetic
Posts: 2
Joined: 25 Jun 2008 07:31

#2 Post by psinetic » 26 Jun 2008 01:45

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:

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 :P

Thebetr1
Posts: 12
Joined: 30 Jun 2008 02:50
Location: My computer
Contact:

#3 Post by Thebetr1 » 30 Jun 2008 04:50

tell me if this is what you want

Code: Select all


@ECHO OFF

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


Post Reply