Running Batch Files in Access 2000

  • Thread starter Thread starter Ant
  • Start date Start date
A

Ant

Hi,
I have searched this site inside and out on information about running .bat
files through Access. The most common answer is to set a RunApp macro with
the batch files path in quotes as the Command Line. That works...for some of
my batch files. If I make a test batch file with something like ipconfig in
there, it will run. My FTP batch files, however, will not. There are no
spaces in my file path (I:\Ant\NewSources.bat) and all it does is open and
close lightning fast. If I run the process on my own, it will run. Just
trying to add a little more automation to the job! haha, thanks in advance.
 
Sorry to sound ignorant, but I am so lost in all of that code! hahaha. All
my batch files do is connect to the FTP and collect extracted data to a text
file. I:\Ant\downloadnewsoureces.bat is the path. I click on that, and it
runs my second batch file that actually inputs the username/pwd and does all
of the real work. I'm quite the noob at VBA, and i apologize. Would I paste
this code in a button?
 
Ok, I'll give that a shot. The way I have it set-up now, the DOS window says
"Error opening script file ucftp.bat." which is the second .bat file of the
two we are trying to run. If I do it manually, it runs without any problems.
I just made the RunApp macro and thats my result for it. I'll try your
method out and keep my fingers crossed! :)
 
OK, I got it to work with a few edits to the batch files. I first had to
take out any spaces. Then I wrote this quick instruction guide for everyone
here in the office:

How To Run Batch Files Through MS Access:

1)Make sure your file path has No SPACES
2)Make a macro
3)Set macro action to RunApp
4)In the command line, input your files path in quotes
(ex:"C:\TestFolder\test.bat") then save & name macro
5)If your batch file is running ftp, make sure you put the full path to
where you are saving the text file,including file name (ex:get DistroList.prn
i:\distrolist\DistroList.txt)
6)Drag and drop your macro to your form if you wish to run the macro via
button click.
7)Enjoy!
 
OK, I got it to work with a few edits to thebatchfiles.  I first had to
take out any spaces.  Then I wrote this quick instruction guide for everyone
here in the office:

How ToRunBatchFiles Through MSAccess:

1)Make sure yourfilepath has No SPACES
2)Make amacro
3)Setmacroaction to RunApp
4)In the command line, input your files path in quotes
(ex:"C:\TestFolder\test.bat") then save & namemacro
5)If yourbatchfileis running ftp, make sure you put the full path to
where you are saving the textfile,includingfilename (ex:get DistroList.prn
i:\distrolist\DistroList.txt)
6)Drag and drop yourmacroto your form if you wish torunthemacrovia
button click.
7)Enjoy!

Looking to create the same results using Access 2003 in XP via Macros
to run a batch file that will delete files from within a givin
directory. The path of the directory is c:\tucker\clean.bat. in this
bat file the following exists
cd\
cd c:\tucker\
del *.csv
All I get from Access>Macros>RunApp>C:\Tucker\Clean.bat is a quick
flash of the CMD window and no results. Of course if I run it myself
in Start or by click the bat file works flawlessly. Any ideas? Anyone?
 
Back
Top