Let my preface this by saying I have no experience with writing batch files at all so go easy on me. What I'm currently trying to do is read a single line from a .txt file and store that line into a variable in a batch file.
I'm using the following syntax to try to set the variable value:
set /p varname=<tempres.txt
I'm then trying to append the value of this variable to an output file name (within an osql statement) as follows:
osql -E -S .\[i]instance,port[/i] -d msdb -h-1 -n -w1000 -i "D:\batchtest\tables.sql" -o "D:\batchtest\newsqlexport_D%date:~-4,4%%date:~-7,2%%date:~-10,2%_T%time:~0,2%%time:~3,2%%time:~6,2%%time:~9,2%_0%_0%varname%"
The output file creates successfully and has everything in the file name that it should up to the "_0". What am I doing wrong that the value of varname
isn't being appended to the file name?
Thanks in advance for the help!