Thanks, Doug. Regarding the Randy Birch site, I thought you might
have been referring to the section on using INI files??? I found
nothing there though. Which part exactly were you talking about?
BTW, I seem to have run into a snag with ShellWait...
Call ShellWait("ipconfig /all >c:\IPdata.txt") DID NOT WORK!!!
ShellWait ("ipconfig /all >c:\IPdata.txt") DID NOT WORK!!!
#AND#
Call ShellWait("c:\Program Files\TPSCG\GetConf.bat") WORKED!
ShellWait ("c:\Program Files\TPSCG\GetConf.bat") WORKED!
I don't understand. The batch file GetConf.bat contains the same CMD
string ipconfig /all >c:\IPdata.txt but I've tested and the
file "IPdata.txt" is not being created using the syntax in the first
two cases.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>No reason that I can think of.
>
[quoted text clipped - 7 lines]
>VB vs. those available on forms in Access. Consequently, not all of the
>GUI-related code on Randy's site will port into Access)
Two possible reasons why
1) The environment (particularly the PATH) may be different in the cmd
shell as opposed to the windows shell
2) As ipconfig is a dos program it may just not like being run in this
way.
You could have tried
Call ShellWait(environ$("comspec") & " /C ipconfig /all >c:\IPdata.txt")

Signature
Terry Kreft
> Thanks, Doug. Regarding the Randy Birch site, I thought you might
> have been referring to the section on using INI files??? I found
[quoted text clipped - 26 lines]
>>VB vs. those available on forms in Access. Consequently, not all of the
>>GUI-related code on Randy's site will port into Access)
MLH - 13 Dec 2005 16:42 GMT
>Two possible reasons why
> 1) The environment (particularly the PATH) may be different in the cmd
>shell as opposed to the windows shell
Thx Terry. I checked the path this way: Click Start, Run, "CMD" and
typed Path. C:\WINDOWS\System32\ was in the path and IPconfig.exe
is there.
> 2) As ipconfig is a dos program it may just not like being run in this
>way.
You're probably right with this one.
>You could have tried
> Call ShellWait(environ$("comspec") & " /C ipconfig /all >c:\IPdata.txt")
I would like to explore this, but am unsure what's meant by environ$
and comspec.
Terry Kreft - 13 Dec 2005 18:47 GMT
Environ$ is a VBA function which returns the values of environment strings.
So
Environ$("Path")
returns the Path environment string
Comspec is the environment string which holds the path to your command line
interpreter, so on my current machine
Environ$("comspec")
returns
C:\WINDOWS\system32\cmd.exe
The /C is a switch to cmd.exe to say run the command and then close.
Therefore on my machine
environ$("comspec") & " /C ipconfig /all >c:\IPdata.txt"
translates as
C:\WINDOWS\system32\cmd.exe /C ipconfig /all >c:\IPdata.txt

Signature
Terry Kreft
>>Two possible reasons why
>> 1) The environment(particularly the PATH) may be different in the cmd
[quoted text clipped - 12 lines]
> I would like to explore this, but am unsure what's meant by environ$
> and comspec.
MLH - 14 Dec 2005 03:32 GMT
YES!
It worked like a charm. Many, many thx.
MLH - 13 Dec 2005 17:02 GMT
Its also worth mentioning the following...
Shell("ipconfig /all >c:\IPdata.sys") does not work from VBA
Click Start, Run then ipconfig /all >c:\IPdata.sys doesn't either
Nor does Start, Run c:\windows\system32\ipconfig /all >c:\IPdata.sys
Now the batch file, on the other hand, seems to have no problems...
Shell("c:\Program Files\TPSCG\GetConf.bat") works
Click Start, Run then c:\Program Files\TPSCG\GetConf.bat works
And of course Call ShellWait("c:\Program Files\TPSCG\GetConf.bat")
works too (obviously)
All produce the desired file...
Directory of C:\
12/13/2005 11:52 AM 877 IPdata.sys
1 File(s) 877 bytes
0 Dir(s) 9,338,142,720 bytes free
The page I sent you to doesn't have anything about INI files.
It has a number of different code snippets to get you information about IP
addresses, MAC addresses, DNS and DHCP servers and the like. Since that's
typically the type of information I'm looking for when I run ipconfig /all,
I thought you might be able to get the information you were looking for
directly.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> Thanks, Doug. Regarding the Randy Birch site, I thought you might
> have been referring to the section on using INI files??? I found
[quoted text clipped - 26 lines]
>>VB vs. those available on forms in Access. Consequently, not all of the
>>GUI-related code on Randy's site will port into Access)
MLH - 14 Dec 2005 04:09 GMT
You're absolutely right. When I first hit the page,
I clicked some of the links at the top, rather than
scrolling downward. Thank-you. The information
on that page is quite helpful. I even found some
VB code for sync'ing with time servers I found
interesting.