Re: How to communicate with a batch file

From: Bob Altman (rda_at_nospam.com)
Date: 05/09/04


Date: Sun, 9 May 2004 09:21:23 -0700

Uhhh... Never mind. I found the one-line reference to the double-% magic
buried in the help text that comes back when I type HELP FOR at a command
line prompt.

Thanks again for all the help!

  - Bob

"Bob Altman" <rda@nospam.com> wrote in message
news:OfO5$0dNEHA.700@TK2MSFTNGP10.phx.gbl...
> Thanks Torgeir, that exactly what I'm looking for! What's the deal with
the
> double-% syntax (%%a) in your sample? More to the point, where can I find
> documentation on that sort of magic?
>
> - Bob
>
> "Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
> news:O5vqbjVNEHA.636@TK2MSFTNGP10.phx.gbl...
> > Bob Altman wrote:
> >
> > > When I invoke reg.exe, it spits out a bunch of stuff to StdOut
> (including
> > > some blank lines, a banner line, and a line that contains the key
name,
> > > type, and value). I can't find a way to ask reg.exe to just give me
the
> > > value string in a form that my batch file can easily consume it.
> > Hi
> >
> > Try this batch file, it should report the country you have set
> > your computer to under Control Panel/International (note: the
> > 'for ...' line might be wrapped over two lines by the newsreader,
> > in that case, unwrap it):
> >
> > @echo off
> > set regvaluedata=
> > set regkey="HKCU\Control Panel\International"
> > set regvalue="sCountry"
> > :: line above for command (line might wrap)
> > for /f "Skip=4 Tokens=3" %%a in ('REG.EXE QUERY %regkey% /v %regvalue%')
> do set regvaluedata=%%a
> > :: line under for command
> > echo %regvaluedata%
> > pause
> >
> >
> > --
> > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> > Administration scripting examples and an ONLINE version of
> > the 1328 page Scripting Guide:
> > http://www.microsoft.com/technet/community/scriptcenter/default.mspx
>
>



Relevant Pages

  • Re: How to run a .exe with different credential
    ... >>> You may also want to check out PolicyMaker Application Security ... >>> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.windows.server.scripting)
  • Re: SP2 via Update V5 with Sygate Firewall.
    ... >> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ... I had that prob - I took Sygate back off and put Kerio back up - no probs. ... Defragger Raxco PerfectDisk6 rocks! ...
    (microsoft.public.windowsxp.general)
  • Re: Windows XP SP2 setup error.
    ... >>Then do a reboot and see if SP2 installs after this. ... >>torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windowsxp.general)
  • Re: Error after scanning without any error number .
    ... AutomaticUpdates with code Call complete and error 0 ... help with this problem Torgeir. ... > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.windowsupdate)
  • Re: File in Use
    ... >> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ... >> Administration scripting examples and an ONLINE version of ...
    (microsoft.public.scripting.vbscript)