set batch variable to value from text file
Moderator: DosItHelp
-
- Posts: 2
- Joined: 19 Jul 2012 10:51
set batch variable to value from text file
How do set batch variable to value from text file?
Re: set batch variable to value from text file
If it is the first line of the text file.
Code: Select all
set /p value=<myfile.txt
-
- Posts: 2
- Joined: 19 Jul 2012 10:51
Re: set batch variable to value from text file
Code: Select all
C:\test>type sman.bat
@echo off
echo DosMaster > sman.txt
set /p var=<sman.txt
echo var=%var%
C:\test>
C:\test>sman.bat
var=DosMaster
C:\test>
Re: set batch variable to value from text file
DosMaster has a trailing space, if it matters 

Re: set batch variable to value from text file
'
Didn't I ban you billrich, TB99 or whatever it will be next, we are not idiots.
Didn't I ban you billrich, TB99 or whatever it will be next, we are not idiots.