Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 08-18-2007, 06:20 PM   #1
In Runtime
 
lhamil64's Avatar
 
Join Date: Jan 2007
Posts: 398
Default Batch script help

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
__________________

__________________
--Lee
Website/Blog: http://lhamil64.wordpress.com
lhamil64 is offline   Reply With Quote
Old 08-27-2007, 07:46 PM   #2
In Runtime
 
lhamil64's Avatar
 
Join Date: Jan 2007
Posts: 398
Default Re: Batch script help

OK its been a while now and nobody has responded (bumping )
__________________

__________________
--Lee
Website/Blog: http://lhamil64.wordpress.com
lhamil64 is offline   Reply With Quote
Old 08-30-2007, 11:05 AM   #3
In Runtime
 
lhamil64's Avatar
 
Join Date: Jan 2007
Posts: 398
Default Re: Batch script help

Hello? Has anybody even tried looking this up?
__________________
--Lee
Website/Blog: http://lhamil64.wordpress.com
lhamil64 is offline   Reply With Quote
Old 09-04-2007, 02:04 PM   #4
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: Batch script help

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
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 09-08-2007, 09:12 AM   #5
In Runtime
 
lhamil64's Avatar
 
Join Date: Jan 2007
Posts: 398
Default Re: Batch script help

Oh ok. thanks!
__________________
--Lee
Website/Blog: http://lhamil64.wordpress.com
lhamil64 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 11:37 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0