Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Batch File Help
Name: Adam Date: April 17, 2002 at 22:46:29 Pacific
Comment:
Hey, I'm wondering if there's a way I could set the volume label of a drive as a variable. Is this at all possible? Thanks!
Name: Secret_Doom Date: April 18, 2002 at 10:55:45 Pacific
Reply:
This should do it, at least on Win9x:
:: Get volume label to %vol% @echo off if "%1"=="GoTo:" %1%2 (Subroutine handler) :: ASCII Assembler by Laura Fairhead ECHO XPYP[*'CC-\1P\QX,=P,APZ5O!PQ2O~5aaI~}Ksx>%temp%.\echos.com %temp%.\echos.com SET VOL=> %temp%.\temp.bat VOL |FIND " " |FIND/v "-" >> %temp%.\temp.bat call %temp%.\temp.bat call %0 GoTo: setvol %vol% if exist %temp%.\temp.bat del %temp%.\temp.bat if exist %temp%.\echos.com del %temp%.\echos.com goto eof :setvol set vol=%1 shift if not "%1"=="" goto setvol :eof
Watch out for line wrapping!
-- Secret_Doom - Leonardo Pigntaro --
secret_doom@hotmail.com www.batch.hpg.com.br
0
Response Number 2
Name: B. Gates Date: April 19, 2002 at 13:32:08 Pacific
Reply:
Didn't work, but this one does: http://life.homepage.dk/batfiles/main/batfaq2.htm#55
0
Response Number 3
Name: Secret_Doom Date: April 20, 2002 at 10:12:48 Pacific
Reply:
B. Gates, what do you mean by "didn't work"? Have you actually tested it, and are you actually on Win9x? The label will be saved on %vol% and will NOT be echoed to screen (nobody said it should do so).
If you are running the batch in a child shell, obviously you won't be able to see the %vol% variable in the parent shell.
Have you actually tested it? It's just too easy to say "didn't work".
-- Secret_Doom - Leonardo Pignataro --
secret_doom@hotmail.com www.batch.hpg.com.br
0
Response Number 4
Name: Secret_Doom Date: April 20, 2002 at 10:45:10 Pacific
Reply:
BTW, that script has been tested under Win95 (in english) AND under Win98 (in portuguese).
Summary: iam trying to make a batch file so that it copies some dll files from the cdrom from to the system directory. since the cdrom drive letter may vary in different systems iam trying to accept an input ...
Summary: Can anyone help me with this problem i am having. I am trying to get this stupid Batch file to work on an NT machine. How do I make an enviromental variable = to the contents of a text file? Thanks fo...
Summary: Comment: hey every one , I would like to create a batch file that will do the following: when i start a computer for new install i want the batch file to see if there is c, b, d, f, h, drived and so ...