DO 11 Script - Set current path for application

Suppose I want to invoke a program that will operate on a file..

"C:\Program Files\SomeProgFolder\SomeProg.exe" "C:\SomeImprobablyLongPathThatJustGoesOnAndOn...........\MyFile.txt"

Is there any way, within a script, to specify the "active" path so that the file name can be supplied without its unreasonably long full path. Pseudo code:

filepath = "C:\SomeImprobablyLongPathThatJustGoesOnAndOn..........." cmd = "C:\Program Files\SomeProgFolder\SomeProg.exe" arg = "MyFile.txt" With FuncCmd .addline cmd & " " arg ' e.g. "C:\Program Files\SomeProgFolder\SomeProg.exe" "MyFile.txt" .runpath = filepath ' Set "active" path to C:\SomeImprobablyLongPathThatJustGoesOnAndOn........... .run ' Run the program with its data path set as above End With

I tried forcing a current directory change with objshell.currentdirectory to no avail. The application looks for the supplied file name in C:\Windows\system32.

Regards, AB

Just add a cd command line first.

 With FuncCmd
      .addline "cd C:\SomeImprobablyLongPathThatJustGoesOnAndOn..........."
      .addline cmd & " " arg ' e.g. "C:\Program Files\SomeProgFolder\SomeProg.exe" "MyFile.txt"
      .runpath = filepath
      .run                   ' Run the program with its data path set as above
   End With

Thanks. So simple... :slight_smile:

Regards, AB