View Single Post
Old 07-01-2009   #3 (permalink)
ekkehard.horner


 
 

Re: wshell.run path building help

Gavaskar schrieb:
Quote:

> Hello
>
> I'm trying to run a program, lets use mspaint as an example.
>
> I've got mspaint in the folder path
>
> c:\Program Files\Company Name\Version-001\mspaint.exe
> c:\Program Files\Company Name\Version-002\mspaint.exe
> c:\Program Files\Company Name\Version-003\mspaint.exe
>
>
> When I run the script, I query the file mspaint.exe for the version number,
> so I know which one to execute, and I assign that version ID to a variable
> VersionString.
> The returned string will be "Version-001" or "Version-002" or "Version-003"
>
>
> My problem is when I do a wshShell.run I'm having problems with the white
> spaces and adding the variable.
>
> Mypath = """c:\Program Files\Company Name\""" & VersionString &
> "\mspaint.exe", 3, False
(1) The trailing '3, False' surely is a copy & paste artefact

(2) If you WScript.Echo Mypath it will look like

"c:\Program Files\Company Name\"Version-003\mspaint.exe

(3) So

Mypath = """c:\Program Files\Company Name\" & VersionString & "\mspaint.exe"""
Quote:

>
> wshshell.run Mypath, 3, False
>
> I always get a error message that it can not find the specified file
>
> Any Ideas?
My System SpecsSystem Spec