Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005

    Shell with Batch Variables

    I have a Batch file that has this command called test.bat

    copy %1 %2

    Then on a form I have a button with this command:

    Private Sub cmdBackBatch_Click()

    On Error GoTo err_cmdBackBatch_Click

    Dim strSource As String
    Dim strDest As String

    strSource = "C:\Documents and Settings\A\My Documents\Robby\Tracker\TrackerDev\FE-BE\ABCMngr97_be.mdb"
    strDest = "C:\Documents and Settings\A\My Documents\Robby\Tracker\TrackerDev"

    Shell "C:\Documents and Settings\A\My Documents\Robby\Tracker\TrackerDev\FE-BE\test.bat" & strSource & " " & strDest

    Exit Sub

    MsgBox err.Description
    Resume Exit_cmdBackBatch_Click
    End Sub

    For some reason I am not able to pass the strSource and strDest variables to the %1 and %2 of the batch file command.

    Does anyonw have some input on this?


  2. #2
    BrooksR is offline Novice
    Windows 10 Access 2007
    Join Date
    Nov 2018
    One problem I see is needing a space after ... test.bat"

    Change: Shell "C:\Documents and Settings\A\My Documents\Robby\Tracker\TrackerDev\FE-BE\test.bat" & strSource & " " & strDest
    To: Shell "C:\Documents and Settings\A\My Documents\Robby\Tracker\TrackerDev\FE-BE\test.bat " & strSource & " " & strDest

    Not sure if this is the only problem. Might be helpful to know the exact error you're seeing.


  3. #3
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Nevada, USA
    I'm guessing after 14 years the issue has been resolved.
    Paul (wino moderator)
    MS Access MVP 2007-2019

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

Similar Threads

  1. Open Accesss DB by batch script
    By micada in forum Access
    Replies: 0
    Last Post: 06-10-2008, 02:33 PM
  2. New Database - Batch processing
    By stevo2820 in forum Database Design
    Replies: 0
    Last Post: 04-30-2007, 02:22 AM
  3. sql in vb variables
    By emilylu3 in forum Programming
    Replies: 3
    Last Post: 03-04-2006, 01:26 PM

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 - Senior Forums