How do you call a .bat file from code?

G

Guest

I have tried a variety of combinations in the previous posts:

Shell "\\ngclds00\etb\databases\rawdata\proaxiom (do not remove).bat",
vbMinimizedNoFocus

Shell "cmd.exe /C ""\\ngclds00\etb\databases\rawdata\proaxiom (do not
remove).bat"""

But I cannot get the .bat file to run. I have never ran anything like this
before and do not know where I am going wrong.

Any help would be appreciated.
 
D

Dirk Goldgar

In
fishy said:
I have tried a variety of combinations in the previous posts:

Shell "\\ngclds00\etb\databases\rawdata\proaxiom (do not remove).bat",
vbMinimizedNoFocus

Shell "cmd.exe /C ""\\ngclds00\etb\databases\rawdata\proaxiom (do not
remove).bat"""

But I cannot get the .bat file to run. I have never ran anything like
this before and do not know where I am going wrong.

Any help would be appreciated.

The second one:

Shell "cmd.exe /C ""\\ngclds00\etb\databases\rawdata\proaxiom (do
not remove).bat"""

.... looks to me like it should work. How certain are you that the .bat
file isn't running? Are you getting an error message? You could try
getting the return code from the Shell function:

Debug.Print Shell("cmd.exe /C
""\\ngclds00\etb\databases\rawdata\proaxiom (do not remove).bat""")

If the return code is nonzero, that implies that the process was
successfully run.
 
G

Guest

the bat file should rename a series of files. when I run this outside of
access it works.

Will try at work tomorrow and advise.
 

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