Re: Paths including spaces

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



And how is the script supposed to figure out that sequence number?

If you're going for the "short path" solution, then at least use the
FSO ShortPath property. It's the only way to know for sure.

Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(objShell.ExpandEnvironmentStrings( _
"%ProgramFiles%\TestApp\RunMe.exe"))
sEXEFullPath = objFile.ShortPath & " /silent"

--
Björn Holmgren


"Rafael T" <okinawapro@xxxxxxxxxxx> wrote in message
news:#t3YkEBPFHA.3000@xxxxxxxxxxxxxxxxxxxxxxx
> I usually use the old trick for long file names, 8 characters. The first 6
> are from the real name and then follow by a ~ and at last the number 1 if
it
> is the first or only file/folder with those first 6 letters.
>
> in your case
> progra~1/TestApp\runme.exe
>
> try it and see if it works
> RT
>
> "Wayne Gore" <WayneGore@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:9F5C05B5-DDF2-4D9A-A090-A6FF4D5D65E2@xxxxxxxxxxxxxxxx
> > Hi
> >
> > I'm trying to put together a script which expands %ProgramFiles% and
then
> > run an executable called "RunMe.exe" from a folder called "TestApp".
> >
> > Here's what I've done:
> >
> > Set oWshShell = CreateObject("WScript.Shell")
> > sEXEFullPath = oWshShell.ExpandEnvironmentStrings("%ProgramFiles%" &
> > "\TestApp\RunMe.exe /silent")
> > Return = oWshShell.Run(sEXEFullPath,,true)
> >
> > The error message states that "The system cannot find the file
> > specified.".
> > I know that the file is there and just to check I added the row
> > "WScript.Echo sEXEFullPath" to check that the path is correct. Every
thing
> > is
> > ok.
> >
> > As far as I can tell, the reason for the failure of the run command is
the
> > space between "Program" and "Files" in the expanded path. It seems as if
> > the
> > engine only sees "C:\Program" and not "C:\Program
Files\TestApp\RunMe.exe
> > /silent".
> >
> > How can I fix this?
> >
> > Regards
> > Wayne
> >
>
>


.