Computing.Net > Forums > Disk Operating System > Batch File Help

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

Reply to Message Icon

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!



Sponsored Link
Ads by Google

Response Number 1
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).

-- Secret_Doom - Leonardo Pignataro --

secret_doom@hotmail.com
www.batch.hpg.com.br


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Batch File Help

basic batch file help needed www.computing.net/answers/dos/basic-batch-file-help-needed/1019.html

DOS Batch file help www.computing.net/answers/dos/dos-batch-file-help/6382.html

batch file help please www.computing.net/answers/dos/batch-file-help-please/9905.html