Batch script help

lhamil64

In Runtime
Messages
398
In batch, is there a way to have a string (containing other variables) get "put into" the variable?

The batch script i am trying to make (in the end) (hopefully) print the path to the current user's startup folder into a text file.

here is what i have so far.

Code:
@echo off 
set startup="%HOMEDRIVE%%HOMEPATH%\Startup"
echo startup
pause

if you replace "set startup" with "echo" it will print out the path to your startup folder.

In the language i usually program in (Liberty BASIC) all you have to do is this:

Code:
Variable2="Hi."
varName$="String"+Variable2$+"Next part."
print varName$

and it would read: "StringHi.Next part.

So i was thinking it would be something like that in batch (i also googled how but nothing came up)

Any ideas?

-lhamil64
 
sorry, been away for a little while with no time to check this part of the forums,

the problem is in basic you're first declaring the variable name as a variable, that never happens in your batch file,
in the basic script you're marking variables with a dollar sign variable$

in basic you mark variables with percent signs

yuor script will work if you write it like this

Code:
@echo off 
set startup="%HOMEDRIVE%%HOMEPATH%\Startup"
echo %startup%
pause
 
Back
Top Bottom