Running a batch file from Execut Process Task

  • Hi All,

    I am trying to pass a file name to the Execute Process Command line.  I build the file name in a preceding step by setting a global variable in an ActiveX task.  My problem is that the path has a space in it (i.e., C:\Program Files\).  I know this is purely syntax but I am tired of fighting it.

    Here is my current global variable code

    Dim pkg, gvDTSPkg, gvBatFile

     Set pkg = DTSGlobalVariables.Parent

     Set gvBatFile = pkg.GlobalVariables("BatFile")

     gvBatFile.Value = "''C:\Program Files\Microsoft SQL Server Accelerator for BI\data''"'

    I have quotes then 2 tick marks at the beginning and the end of the string (to wrap the string in quotes when it is passed).

    I have tried without the ticks as well.

    What happens is that the command line only gets "C:\Program.  The rest of the string ends up on the parameters line.

    Any suggestions?

    Thanks in advance for your help.

    Robin

  • Try changing C:\Program Files\Microsoft SQL Server Accelerator\data to C:\Progra~1\Micros~1\data.

    Tthis is the short naming convention (that still works). Before you make the change make sure that it change you to the correct directory by going to a dos box and entering dir c:\Progra~1\Micros~1\data and checking that you have the correct directory. Depending upon your installation order the ~1 could be ~2 or ~3 etc...



    Shamless self promotion - read my blog http://sirsql.net

  • try this:

     

    gvBatFile.Value = chr(34) & "C:\Program Files\Microsoft SQL Server Accelerator for BI\data" & chr(34)

  • if putting quotes around your path will solve your problem, then:

    """ & "c:\program files\etc\" & """

    should do the trick.

  • Thanks for all your suggestions.  The one that I tried was Stacenic's suggestion.  Since it worked, I haven't tried the others but thanks again for your help!!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply