I'm trying to run the following, but I always receive an error due to
the space between Program Files. I've tried quoting it in standard
style and in ascii but then the file cannot be found. The file is at
the path specified. Anyone see the error?

Set WSHShell = CreateObject("Wscript.Shell")
return = WSHShell.run ("C:\Program Files\7-Zip\7z.exe e C:\ziptest
\test.zip -y -oc:\ziptest *.txt -r",1,true)

Re: wscript.shell Run file with space in path by ekkehard

ekkehard
Tue Mar 11 09:41:41 CDT 2008

requeth@gmail.com schrieb:
> I'm trying to run the following, but I always receive an error due to
> the space between Program Files. I've tried quoting it in standard
> style and in ascii but then the file cannot be found. The file is at
> the path specified. Anyone see the error?
>
> Set WSHShell = CreateObject("Wscript.Shell")
> return = WSHShell.run ("C:\Program Files\7-Zip\7z.exe e C:\ziptest
> \test.zip -y -oc:\ziptest *.txt -r",1,true)
One method to get " into a literal string is to 'escape it' the VBScript
way: use "" (where you would use \" in C/C++).

return = WSHShell.run( """C:\Program Files\7-Zip\7z.exe"" e ...



Re: wscript.shell Run file with space in path by requeth

requeth
Tue Mar 11 09:54:59 CDT 2008

On Mar 11, 9:41=A0am, "ekkehard.horner" <ekkehard.hor...@arcor.de>
wrote:
> requ...@gmail.com schrieb:> I'm trying to run the following, but I always =
receive an error due to
> > the space between Program Files. I've tried quoting it in standard
> > style and in ascii but then the file cannot be found. The file is at
> > the path specified. Anyone see the error?
>
> > Set WSHShell =3D CreateObject("Wscript.Shell")
> > return =3D WSHShell.run ("C:\Program Files\7-Zip\7z.exe e C:\ziptest
> > \test.zip -y -oc:\ziptest *.txt -r",1,true)
>
> One method to get " into a literal string is to 'escape it' the VBScript
> way: use "" (where you would use \" in C/C++).
>
> =A0 =A0return =3D WSHShell.run( """C:\Program Files\7-Zip\7z.exe"" e ...

I'm still receiving the error that the file cannot be found. I'm
tyring:

Set WSHShell =3D CreateObject("Wscript.Shell")
return =3D WSHShell.run ("C:\""Program Files""\7-Zip\7z.exe e C:\ziptest
\test.zip -y -oc:\ziptest *.txt -r",1,true)

Re: wscript.shell Run file with space in path by ekkehard

ekkehard
Tue Mar 11 10:06:10 CDT 2008

requeth@gmail.com schrieb:
> On Mar 11, 9:41 am, "ekkehard.horner" <ekkehard.hor...@arcor.de>
> wrote:
>> requ...@gmail.com schrieb:> I'm trying to run the following, but I always receive an error due to
>>> the space between Program Files. I've tried quoting it in standard
>>> style and in ascii but then the file cannot be found. The file is at
>>> the path specified. Anyone see the error?
>>> Set WSHShell = CreateObject("Wscript.Shell")
>>> return = WSHShell.run ("C:\Program Files\7-Zip\7z.exe e C:\ziptest
>>> \test.zip -y -oc:\ziptest *.txt -r",1,true)
>> One method to get " into a literal string is to 'escape it' the VBScript
>> way: use "" (where you would use \" in C/C++).
>>
>> return = WSHShell.run( """C:\Program Files\7-Zip\7z.exe"" e ...
>
> I'm still receiving the error that the file cannot be found. I'm
> tyring:
>
> Set WSHShell = CreateObject("Wscript.Shell")
> return = WSHShell.run ("C:\""Program Files""\7-Zip\7z.exe e C:\ziptest
> \test.zip -y -oc:\ziptest *.txt -r",1,true)

return = WSHShell.run( """C:\Program Files\7-Zip\7z.exe"" e C:\ziptest\test.zip
-y -oc:\ziptest *.txt -r",1,true)

One line; the full path has to be quoted. You would make it easier for yourself
if you'd store the command into a variable and WScript.Echo it to check/compare
against a working command line.



Re: wscript.shell Run file with space in path by CoreyThomasMCSEMCSAMCDBA

CoreyThomasMCSEMCSAMCDBA
Tue Mar 11 11:15:00 CDT 2008

Corrected your code below. The double quotes are needed on the entire string
since it has whitespace:

Set WSHShell = CreateObject("Wscript.Shell")
return = WSHShell.run ("""C:\Program Files\7-Zip\7z.exe e
C:\ziptest\test.zip -y -oc:\ziptest *.txt -r""",1,true)


-Corey

"requeth@gmail.com" wrote:

> On Mar 11, 9:41 am, "ekkehard.horner" <ekkehard.hor...@arcor.de>
> wrote:
> > requ...@gmail.com schrieb:> I'm trying to run the following, but I always receive an error due to
> > > the space between Program Files. I've tried quoting it in standard
> > > style and in ascii but then the file cannot be found. The file is at
> > > the path specified. Anyone see the error?
> >
> > > Set WSHShell = CreateObject("Wscript.Shell")
> > > return = WSHShell.run ("C:\Program Files\7-Zip\7z.exe e C:\ziptest
> > > \test.zip -y -oc:\ziptest *.txt -r",1,true)
> >
> > One method to get " into a literal string is to 'escape it' the VBScript
> > way: use "" (where you would use \" in C/C++).
> >
> > return = WSHShell.run( """C:\Program Files\7-Zip\7z.exe"" e ...
>
> I'm still receiving the error that the file cannot be found. I'm
> tyring:
>
> Set WSHShell = CreateObject("Wscript.Shell")
> return = WSHShell.run ("C:\""Program Files""\7-Zip\7z.exe e C:\ziptest
> \test.zip -y -oc:\ziptest *.txt -r",1,true)
>

Re: wscript.shell Run file with space in path by Pegasus

Pegasus
Tue Mar 11 12:03:01 CDT 2008

If you follow Ekkehard's recommendation and turn the command
into a string then you will see immediately that your code cannot
possibly work:

Set WSHShell = CreateObject("Wscript.Shell")
wscript.echo """C:\Program Files\7-Zip\7z.exe e
C:\ziptest\test.zip -y -oc:\ziptest *.txt -r"""


"Corey Thomas - MCSE/MCSA/MCDBA"
<CoreyThomasMCSEMCSAMCDBA@discussions.microsoft.com> wrote in message
news:71724248-2EB9-481C-82B4-D1294A228B4E@microsoft.com...
> Corrected your code below. The double quotes are needed on the entire
> string
> since it has whitespace:
>
> Set WSHShell = CreateObject("Wscript.Shell")
> return = WSHShell.run ("""C:\Program Files\7-Zip\7z.exe e
> C:\ziptest\test.zip -y -oc:\ziptest *.txt -r""",1,true)
>
>
> -Corey
>
> "requeth@gmail.com" wrote:
>
>> On Mar 11, 9:41 am, "ekkehard.horner" <ekkehard.hor...@arcor.de>
>> wrote:
>> > requ...@gmail.com schrieb:> I'm trying to run the following, but I
>> > always receive an error due to
>> > > the space between Program Files. I've tried quoting it in standard
>> > > style and in ascii but then the file cannot be found. The file is at
>> > > the path specified. Anyone see the error?
>> >
>> > > Set WSHShell = CreateObject("Wscript.Shell")
>> > > return = WSHShell.run ("C:\Program Files\7-Zip\7z.exe e C:\ziptest
>> > > \test.zip -y -oc:\ziptest *.txt -r",1,true)
>> >
>> > One method to get " into a literal string is to 'escape it' the
>> > VBScript
>> > way: use "" (where you would use \" in C/C++).
>> >
>> > return = WSHShell.run( """C:\Program Files\7-Zip\7z.exe"" e ...
>>
>> I'm still receiving the error that the file cannot be found. I'm
>> tyring:
>>
>> Set WSHShell = CreateObject("Wscript.Shell")
>> return = WSHShell.run ("C:\""Program Files""\7-Zip\7z.exe e C:\ziptest
>> \test.zip -y -oc:\ziptest *.txt -r",1,true)
>>



Re: wscript.shell Run file with space in path by ekkehard

ekkehard
Tue Mar 11 12:48:59 CDT 2008

Pegasus (MVP) schrieb:
> If you follow Ekkehard's recommendation and turn the command
> into a string then you will see immediately that your code cannot
> possibly work:
>
> Set WSHShell = CreateObject("Wscript.Shell")
> wscript.echo """C:\Program Files\7-Zip\7z.exe e
> C:\ziptest\test.zip -y -oc:\ziptest *.txt -r"""
>
>
> "Corey Thomas - MCSE/MCSA/MCDBA"
> <CoreyThomasMCSEMCSAMCDBA@discussions.microsoft.com> wrote in message
> news:71724248-2EB9-481C-82B4-D1294A228B4E@microsoft.com...
>> Corrected your code below. The double quotes are needed on the entire
>> string
>> since it has whitespace:
>>
>> Set WSHShell = CreateObject("Wscript.Shell")
>> return = WSHShell.run ("""C:\Program Files\7-Zip\7z.exe e
>> C:\ziptest\test.zip -y -oc:\ziptest *.txt -r""",1,true)
[...]
It won't work, if the whole command line (pathes and options)
is enclosed in " (written as ""), but putting the " where they
are needed (the full file spec for 7z.exe) should be correct.