Results 1 to 4 of 4
  1. #1
    shay is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    3

    Run batch file

    Hello, I have a simple batch that I'd like to run.
    I'v tried - call Shell ( Environ$ ( "COMSPEC" ) & " /c c:\test.bat", vbNormalFocus)
    but nothing happend.
    The batch works good seperatly...
    I don't know where/how to use it: is it in "RunApp" or "RunCommand" ?


    Do I need to write the code in the "Modules"?

    Thanks

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    usually I just call to run commands directly:
    call Shell ( "c:\test.bat", vbNormalFocus)

  3. #3
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    shay,

    the other thing you might want to do is use the:
    Code:
    /k
    switch instead of "/c". I believe that leaves the DOS window open after execution finishes, so you can read any errors that occur. Otherwise, the prompt closes. Most batch files run so fast that you hardly ever see the window pop up when you use vbnormalfocus.

  4. #4
    shay is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    3
    Thank you, it worked.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Shell with Batch Variables
    By robbyaube in forum Programming
    Replies: 2
    Last Post: 12-19-2019, 11:06 AM
  2. Batch Update
    By Tyork in forum Programming
    Replies: 2
    Last Post: 11-15-2010, 05:33 PM
  3. Batch import .txt
    By hchui in forum Import/Export Data
    Replies: 1
    Last Post: 10-14-2010, 08:57 PM
  4. Running Batch File
    By NoiCe in forum Programming
    Replies: 2
    Last Post: 03-21-2010, 07:05 AM
  5. New Database - Batch processing
    By stevo2820 in forum Database Design
    Replies: 0
    Last Post: 04-30-2007, 02:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums