Home  |   French  |   About  |   Search  | mvps.org  

What's New
Table Of Contents
Credits
Netiquette
10 Commandments 
Bugs
Tables
Queries
Forms
Reports
Modules
APIs
Strings
Date/Time
General
Downloads
Resources
Search
Feedback
mvps.org

In Memoriam

Terms of Use


VB Petition

General: Run Dos Batch files from Access

Author(s)
Dev Ashish

(Q)    How can I run a Dos BAT file from Access?

(A)    An easy way is to use Shell. (Thanks Trevor Best!)

    For example, if I have a batch file called "Test.bat", the code from Access would look like

call Shell ( Environ$ ( "COMSPEC" ) & " /c  c:\test.bat", vbNormalFocus)  

Environ$("COMSPEC") returns the path to Command.com on the machine and the "/c" argument makes sure that the Dos window is automatically closed when the batch file finishes executing.


1998-2010, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer