Can I use VBS variable in strCommand of Run method? 
Author Message
 Can I use VBS variable in strCommand of Run method?

I am trying to set up a file path using VBScript variable.  Three variables
are passed into the page from another page.  These variables are then used
to create the directory/file structure needed to access existing files on
the server.  I am using wscript.shell and then shell.run to open the program
into the file.  The problem is the shell.run program does not understand the
VBScript variable "path" that I have set up.  Does anyone know of a way
around this?  Thank you very much for your time.

 Dim obj, shell, path, temp1, temp2, suff
 temp1 = "#t1#"
 temp2 = "#t2#"
 suff = "#s123#"
 path = "\\Par3\Cad\Drawings\"
 path = path & temp1
 path = path & "\"
 path = path & temp2
 path = path & suff
 path = path & "01.dgn"
 document.write(path)
 set shell = CreateObject("wscript.shell")
 shell.run("C:\Bentley\Program\MicroStation\ustation.exe" & path)

--
Cedar Vandergon



Mon, 30 Dec 2002 03:00:00 GMT  
 Can I use VBS variable in strCommand of Run method?

You need at least one space after the .exe...

 shell.run("C:\Bentley\Program\MicroStation\ustation.exe " & path)

otherwsie you get one big string:

"C:\Bentley\Program\MicroStation\ustation.exe\\Par3\Cad\Drawings\..."

--
Michael Harris
MVP Scripting

I am trying to set up a file path using VBScript variable.  Three variables
are passed into the page from another page.  These variables are then used
to create the directory/file structure needed to access existing files on
the server.  I am using wscript.shell and then shell.run to open the program
into the file.  The problem is the shell.run program does not understand the
VBScript variable "path" that I have set up.  Does anyone know of a way
around this?  Thank you very much for your time.

 Dim obj, shell, path, temp1, temp2, suff
 temp1 = "#t1#"
 temp2 = "#t2#"
 suff = "#s123#"
 path = "\\Par3\Cad\Drawings\"
 path = path & temp1
 path = path & "\"
 path = path & temp2
 path = path & suff
 path = path & "01.dgn"
 document.write(path)
 set shell = CreateObject("wscript.shell")
 shell.run("C:\Bentley\Program\MicroStation\ustation.exe" & path)

--
Cedar Vandergon



Mon, 30 Dec 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using a variable within WshShell object and Run method (newbie at work)

2. How to pass back variables from called vbs from vbs using wsh

3. Problem with run method and vbs

4. Application method or variable that measures memory used

5. Passing a variable using hidden method.

6. Using variables as properties of a Method

7. Copyfile method using variables......

8. Scripting problem using Shell method to run ICQ

9. Can't Launch Office 2000 shortcuts using RUN method in Win2k

10. Permission Denied in Windows 2000 using the RUN method

11. Using Run Method

12. Error in using Run method of Shell object

 

 
Powered by phpBB® Forum Software