JavaScript "\"" and WShell Run 
Author Message
 JavaScript "\"" and WShell Run

I different behaviors on two Win2K (wsh 5.1)
I have a java script that goes something like this:

var shell = WScript.CreateObject("WScript.Shell");
var command = "ss.exe "  + "\"" + someOtherStuff;
WScript.Echo(command); //prints what I expect ss.exe "someOtherStuff"
shell.Run (command); // fails - is seeing ss.exe \"someOtherSuff\"

What am I doing wrong?  What is the correct way to do this?

Any help would be appreciated.




Fri, 23 May 2003 03:00:00 GMT  
 JavaScript "\"" and WShell Run

Quote:
> WScript.Echo(command); //prints what I expect ss.exe "someOtherStuff"
> shell.Run (command); // fails - is seeing ss.exe \"someOtherSuff\"

What Run() "sees" is *exactly* what you see via Echo()...

What makes you think it sees something else?

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--



Fri, 23 May 2003 03:00:00 GMT  
 JavaScript "\"" and WShell Run
Hi,

Quote:
> I different behaviors on two Win2K (wsh 5.1)
> I have a java script that goes something like this:

I would not dispute that using WshShell.Run on Win2K appears to have some
quirks, but this has not been confirmed yet. See my other thread about
WshShell.Run further up this group.

Quote:
> var shell = WScript.CreateObject("WScript.Shell");
> var command = "ss.exe "  + "\"" + someOtherStuff;
> WScript.Echo(command); file://prints what I expect ss.exe "someOtherStuff"
> shell.Run (command); // fails - is seeing ss.exe \"someOtherSuff\"

This doesn't add up for me. Why are you putting this double quote there, and
why is there no closing double quote? Also this does not appear to be a full
working example and in this case I think a full example is needed. Further
to this, What makes you think you can "see" what the Run command is
"seeing"? Did you wrap the whole thing in a de{*filter*} or something?

Again, check out the other thread on this for more ideas.

--
Gerry Hickman
Zak Travel Tech Support

(Note: my e-mail is fake is newsgroup postings)



Sat, 24 May 2003 03:00:00 GMT  
 JavaScript "\"" and WShell Run
Hi Michael,

Quote:
> What Run() "sees" is *exactly* what you see via Echo()...

I'm not sure this is always the case. When using expandable environment
strings "Run" will expand them but Echo won't.

--
Gerry Hickman
Zak Travel Tech Support

(Note: my e-mail is fake is newsgroup postings)



Sat, 24 May 2003 03:00:00 GMT  
 JavaScript "\"" and WShell Run
I could not find any post about Run or any other post from Gerry Hickman in
my previous posts since 11/7.  It's probably archived somewhere.

I did not attempt to post a working script.  I was just trying to explain
what I was doing.

I'll try again with a working script - still considerable simpler than the
original:
NOTE: this fails on some machines and executes properly on others - all
Win2K SP1, wsh version 5.1
//===================================================
// Script to pin a source file in VSS
var WshShell = WScript.CreateObject("WScript.Shell");
var cmd = "ss pin " + "\"" + SomeVSSMethod() + "\"" + " -VHoldForBuild";
WScript.Echo(cmd); // I see:  'ss pin  "$\\0 Weekly
Build\\asanrp\\asaNRP.cpp" -VHoldForBuild'
WshShell.Run(cmd, 0 ); // FAILS - and de{*filter*} shows 'ss pin  "\$\\0 Weekly
Build\\asanrp\\asaNRP.cpp\" -VHoldForBuild
function SomeVSSMethod()
{
// This is actually retrieved using COM - but the spaces in the project name
are important
    return "$\\0 Weekly Build\\asanrp\\asaNRP.cpp";

Quote:
}



Quote:
> Hi,

> > I different behaviors on two Win2K (wsh 5.1)
> > I have a java script that goes something like this:

> I would not dispute that using WshShell.Run on Win2K appears to have some
> quirks, but this has not been confirmed yet. See my other thread about
> WshShell.Run further up this group.

> > var shell = WScript.CreateObject("WScript.Shell");
> > var command = "ss.exe "  + "\"" + someOtherStuff;
> > WScript.Echo(command); file://prints what I expect ss.exe
"someOtherStuff"
> > shell.Run (command); // fails - is seeing ss.exe \"someOtherSuff\"

> This doesn't add up for me. Why are you putting this double quote there,
and
> why is there no closing double quote? Also this does not appear to be a
full
> working example and in this case I think a full example is needed. Further
> to this, What makes you think you can "see" what the Run command is
> "seeing"? Did you wrap the whole thing in a de{*filter*} or something?

> Again, check out the other thread on this for more ideas.

> --
> Gerry Hickman
> Zak Travel Tech Support

> (Note: my e-mail is fake is newsgroup postings)



Sat, 24 May 2003 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Disabling "BACK"/"FORWARD" buttons

2. CreateObject("Excel","//server"), MsgBox output

3. Problem With "window.showmodaldialog("")"

4. Disabling "BACK"/"FORWARD" buttons

5. What's the difference "text/javascript" and "javascript"?

6. How to Replace("String Irregular # of space", "?", "")

7. IE 4.5 Javascript "self.location" Issue

8. href="javascript:..." and IE5

9. Vbscript alternative to Javascripts "settimeout()"

10. Encoding Equivalent to JavaScript "escape()"?

11. "Collection like" class implementation in javascript

12. Problem to display "\" character in javascript

 

 
Powered by phpBB® Forum Software