I have a batch file named GetConf.bat.
It contains a line like this:
ipconfig /all >c:\MyAppDir\IPdata.txt
I believe I could run the line with something
like ShellWait by Terry Kreft. Any reason I
should run the procedure via a batch file
call as opposed to launching the command
string directly? 13 5399
No reason that I can think of.
What are you trying to accomplish, by the way? It may be that you can
retrieve whatever you want without having to resort to those contortions.
Take a look at what Randy Birch has at http://vbnet.mvps.org/code/network/index.html
(ObWarning: Randy's site is aimed at VB programmers, not Access programmers.
There are significant differences between the controls available on forms in
VB vs. those available on forms in Access. Consequently, not all of the
GUI-related code on Randy's site will port into Access)
--
Doug Steele, Microsoft Access MVP http://I.Am/DougSteele
(no e-mails, please!)
"MLH" <CR**@NorthState.net> wrote in message
news:9c********************************@4ax.com... I have a batch file named GetConf.bat. It contains a line like this:
ipconfig /all >c:\MyAppDir\IPdata.txt
I believe I could run the line with something like ShellWait by Terry Kreft. Any reason I should run the procedure via a batch file call as opposed to launching the command string directly?
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.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx
On Tue, 13 Dec 2005 10:14:19 -0500, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote: No reason that I can think of.
What are you trying to accomplish, by the way? It may be that you can retrieve whatever you want without having to resort to those contortions. Take a look at what Randy Birch has at http://vbnet.mvps.org/code/network/index.html
(ObWarning: Randy's site is aimed at VB programmers, not Access programmers. There are significant differences between the controls available on forms in VB vs. those available on forms in Access. Consequently, not all of the GUI-related code on Randy's site will port into Access)
In some conditions, I prefer to use a batch file.
Like starting a database with a workgroup and switches using the "start"
command. Benefit? You don't need to know the full path of msaccess.exe on
each workstation on a network. application.followhyperlink is an
alternative I use to open PDF files.
"MLH" <CR**@NorthState.net> wrote in message
news:9c********************************@4ax.com... I have a batch file named GetConf.bat. It contains a line like this:
ipconfig /all >c:\MyAppDir\IPdata.txt
I believe I could run the line with something like ShellWait by Terry Kreft. Any reason I should run the procedure via a batch file call as opposed to launching the command string directly?
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")
--
Terry Kreft
"MLH" <CR**@NorthState.net> wrote in message
news:19********************************@4ax.com... 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. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx On Tue, 13 Dec 2005 10:14:19 -0500, "Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote:
No reason that I can think of.
What are you trying to accomplish, by the way? It may be that you can retrieve whatever you want without having to resort to those contortions. Take a look at what Randy Birch has at http://vbnet.mvps.org/code/network/index.html
(ObWarning: Randy's site is aimed at VB programmers, not Access programmers. There are significant differences between the controls available on forms in VB vs. those available on forms in Access. Consequently, not all of the GUI-related code on Randy's site will port into Access)
On Tue, 13 Dec 2005 16:25:18 -0000, "Terry Kreft"
<te*********@mps.co.uk> wrote: 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.
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
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
--
Terry Kreft
"MLH" <CR**@NorthState.net> wrote in message
news:hb********************************@4ax.com... On Tue, 13 Dec 2005 16:25:18 -0000, "Terry Kreft" <te*********@mps.co.uk> wrote:
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.
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.
--
Doug Steele, Microsoft Access MVP http://I.Am/DougSteele
(no e-mails, please!)
"MLH" <CR**@NorthState.net> wrote in message
news:19********************************@4ax.com... 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. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx On Tue, 13 Dec 2005 10:14:19 -0500, "Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote:
No reason that I can think of.
What are you trying to accomplish, by the way? It may be that you can retrieve whatever you want without having to resort to those contortions. Take a look at what Randy Birch has at http://vbnet.mvps.org/code/network/index.html
(ObWarning: Randy's site is aimed at VB programmers, not Access programmers. There are significant differences between the controls available on forms in 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 <CR**@NorthState.net> wrote in
news:9c********************************@4ax.com: I have a batch file named GetConf.bat. It contains a line like this:
ipconfig /all >c:\MyAppDir\IPdata.txt
I believe I could run the line with something like ShellWait by Terry Kreft. Any reason I should run the procedure via a batch file call as opposed to launching the command string directly?
I only write a batch file for this kind of thing when the SHELL
commands need to be executed in order. An example of this was where
I was concatenating two files with COPY and then renaming them. I
found it easier to do it all in DOS with a single batch file than to
do multiple SHELLANDWAIT statements in VBA.
I also sometimes write the batch file in code and then call it in
cases where it gets too complicated to pass arguments to the batch
file.
Basically, I think it's better to minimize the number of your SHELL
commands, but that's really only a personal preference. Using even 1
exposes you to the possibility of failure of outside processes, so
there's no difference in kind, just a difference in quantity.
--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
"Saintor" <sa******@REMOVETHIShotmail.com> wrote in
news:2f********************@weber.videotron.net: Like starting a database with a workgroup and switches using the "start" command. Benefit? You don't need to know the full path of msaccess.exe on each workstation on a network. application.followhyperlink is an alternative I use to open PDF files.
The START command doesn't always work on all machines. I have never
been able tofigure out why, though. The Access Web has ShellExecute
API code that would be equivalent and could be run from Access.
--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
YES!
It worked like a charm. Many, many thx.
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ries Spruit |
last post by:
Hiya,
I have a simple program which should be executed from the commandline
by various other programs. The program returns an integer as the
result.
What is the easiest way to pick up this...
|
by: Mark C. |
last post by:
I'm trying to call a batch file that I've built using the FileSystemObject
and CreateObject("Wscript.Shell"), oShell.Run... in an asp script.
Naturally, I can get the script to work from a command...
|
by: Bucky Pollard |
last post by:
I have a web service that needs to create a batch file and call it (since
there are no APIs for the functionality I am looking for). I am using the
Process and ProcessStartInfo objects. When I try...
|
by: Charles Neitzel |
last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C#
2005 Express) that is nothing more than a simple UI with buttons on it. The
buttons do various things like running...
|
by: Charles |
last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual
C#
2005 Express) that is nothing more than a simple UI with buttons on it.
The
buttons do various things like running...
|
by: JoelBrimm |
last post by:
I have a batch file that executes a command line utility to do a secure file
copy from our server to a 3rd party server. The batch file works fine, but
when I call it from the web service the log...
|
by: eric.goforth |
last post by:
Hello,
I have a simple batch file that I'm trying to call from a VB.NET
application:
@ECHO OFF
IF (%1)==() GOTO END
DIR %1 > MYDIR.TXT
:END
@ECHO ON
|
by: shantanu |
last post by:
Hi all
i am trying to imolement a code to run a batch file. But its throwing
error
"No application is associated with the specified file for this
operation"
The code which i am implementing...
|
by: ck9663 |
last post by:
hi guys this is a little challenging, at least for me...here goes...
i have to run a DOS batch file from a server. with some parameters that i need to pass. these parameters can be found on a...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |