Re: windows batch file help

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




"Bill" <Bill@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F80A8505-A5E4-4196-A799-9639BAF1CCE1@xxxxxxxxxxxxxxxx
Long story short, I am creating a batch file to extract the Volume Serial
Number off the computer, and place ONLY the serial number into a text
file.
I start by running the following command from CMD.exe

dir | find /I "serial"

That command returns the following:

Volume Serial Number is 5555-5555

How can I extract or echo ONLY the 5555-5555 to a TXT file from the
command?

Here is how you do it in a Windows batch file:
@echo off
for /F "tokens=5" %%a in ('dir c:\ ^| find /i "volume serial"') do set
Serial=%%a

Best to copy & paste Line 2 in order to avoid typing errors.


.



Relevant Pages

  • Re: Persisting env vars in cmd windows
    ... more about batch files as you go on, ... echo The time is %time::=.% ... But the piece de resistance was the "start" command, ... echo:: ERROR ERROR ERROR ERROR ...
    (microsoft.public.win2000.general)
  • Re: Persisting env vars in cmd windows
    ... But the piece de resistance was the "start" command, ... - Have all code for the one project in one single batch file. ... @echo off ... echo:: ERROR ERROR ERROR ERROR ...
    (microsoft.public.win2000.general)
  • Re: Persisting env vars in cmd windows
    ... even though it applies to any command, e.g. echo, copy, ... Similarly the syntax for the extremely powerful "for" command ... more about batch files as you go on, ... echo:: ERROR ERROR ERROR ERROR ...
    (microsoft.public.win2000.general)
  • Re: Persisting env vars in cmd windows
    ... even though it applies to any command, e.g. echo, copy, ... Similarly the syntax for the extremely powerful "for" command ... more about batch files as you go on, ... echo:: ERROR ERROR ERROR ERROR ...
    (microsoft.public.win2000.general)
  • Re: Persisting env vars in cmd windows
    ... I open several Command windows in succession. ... Drag the name of C000_CreateSymbols.bat into a new command window ... @echo off ... echo:: ERROR ERROR ERROR ERROR ...
    (microsoft.public.win2000.general)