Hiya!
is there a way to make SET create a variable from a small txt ?
let's say I have 1.txt that has inside: 123
and I want to make a variable, let's say: TEST1
so is there a way to make a batch file to SET TEST1=1.txt_content
so I get TEST1=123
??
How can I make SET to set a variable based on txt content?
Moderator: DosItHelp
Re: How can I make SET to set a variable based on txt content?
I did it and the result was this variable:
/P "test1="
I guess plain dos from win98se does not get this command...
/P "test1="
I guess plain dos from win98se does not get this command...
Re: How can I make SET to set a variable based on txt content?
OK I have found this solution that works in plain old DOS:
getdir_ is the variable, edit it to whatever name you want
Code: Select all
@echo off
echo @echo off> director.bat
echo set getdir_=%%2>> director.bat
echo echo %%getdir_%%>> director.bat
dir | find "Directory"> go.bat
call go
if exist director.bat del director.bat
if exist go.bat del go.bat
getdir_ is the variable, edit it to whatever name you want