Batch to run and executable?

B

Ben Samuals

I need to run an executable for all of our users. The exe can run on its own
without any user intervention. However, I need to run this from a logon
script. What I came up with was using reg.exe to dump a key with its data,
the output looking like:


C:\appdev\Registry>reg query
"hkcu\software\microsoft\windows\currentversion\int
ernet settings" /v autoconfigurl

! REG.EXE VERSION 3.0

HKEY_CURRENT_USER\software\microsoft\windows\currentversion\internet
settings
autoconfigurl REG_SZ http://pac.us.proxy.myserver.com:4200

0

Then checking for the correct proxy server autoconfigurl line. The question
is how could I take a part of the http://pac.us.... and set it as a
variable? If that was not true variable=pac then run the exe...

Thx...
 
P

Phil Robyn [MVP]

Ben said:
I need to run an executable for all of our users. The exe can run on its own
without any user intervention. However, I need to run this from a logon
script. What I came up with was using reg.exe to dump a key with its data,
the output looking like:


C:\appdev\Registry>reg query
"hkcu\software\microsoft\windows\currentversion\int
ernet settings" /v autoconfigurl

! REG.EXE VERSION 3.0

HKEY_CURRENT_USER\software\microsoft\windows\currentversion\internet
settings
autoconfigurl REG_SZ http://pac.us.proxy.myserver.com:4200

0

Then checking for the correct proxy server autoconfigurl line. The question
is how could I take a part of the http://pac.us.... and set it as a
variable? If that was not true variable=pac then run the exe...

Thx...

Maybe you could adapt the following example:

=====begin c:\cmd\demo\CheckRegValue.cmd ====================
1. @echo off
2. setlocal
3. set reginfo=autoconfigurl REG_SZ http://pac.us.proxy.myserver.com:4200
4. for /f "tokens=2 delims=:" %%a in ("%reginfo%") do set variable=%%a
5. set variable=%variable:/=%
6. set variable
7. if "%variable:~0,4%" neq "pac." echo It's *not* 'pac.'
=====end c:\cmd\demo\CheckRegValue.cmd ====================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top