[<<]Message[>>]    [<<]Author[>>]    [<<]Subject[>>]        Thread    

Number : 343 Date : 2001-07-06 Author : Joseph Maddison Subject : Re: Question for DOS Gurus Size(KB) : 1
Thank you for the code. This works really well. > I do not understand the statement that reads >         echo set v=%%4>%winbootdir%\volume.bat The line that begins " Volume Serial Number is " is piped to temp.bat and executed. When it executes, it tries to run a program called 'volume'. Since there's a Volume.bat in the directory, it is executed. %4 is parameter #4, the word after "is" on the command line. It's an interesting little batch file (and took me a while to decode). > Why do we need the echo? Why %%4? The volume.bat file seems empty! %% converts to % during batch execution, so this becomes set v=%4 inside volume.bat. Here's the script, revised to work under NT4, which has no vol command. A Dir works just as well. the 2>nul pipes the "File Not Found" to the null device to avoid printing an error. @echo off :: Extracts serial number to use in renaming a log file :: tested in WinNT4 dir \_nofile_at_all 2>nul | find " Volume Serial Number is" >%TEMP%\temp.bat echo set v=%%4>%TEMP%\volume.bat call %TEMP%\temp.bat :: temp.bat calls volume.bat indirectly del %TEMP%\temp.bat del %TEMP%\volume.bat echo The serial number of the current drive is %v% ren xxcopy.log %v%.log set v= _nofile_at_all is just a file that does not exist. Regards, Joseph Maddison Minneapolis, MN
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.