Sign in to follow this  
Followers 0
sshrum

How do I...RunCmd with "&" in arguments

13 posts in this topic

#1 ·  Posted (edited)

$sAppDonations = "http://www.shrum.net/cats.php?body=/code/donations.shtml&dir=/code"
RunWait(@ComSpec & " /c " & "start " & $sAppDonations)

Everything works up to the point where the "&" is which is getting cut off.

What do I need to do in order for this to get passed in its entirety to the browser?

TIA

Edited by sshrum

Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Never mind...

Edited by jefhal

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

this worked

;$sAppDonations = "http://www.shrum.net/cats.php?body=/code/donations.shtml&dir=/code"

$sAppDonations = "www.XPCleanMenu.HostRocket.com"
RunWait(@ComSpec & " /c " & "start " & $sAppDonations, "", @SW_MINIMIZE)

its in your web indentification

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

(Note the original post)

Try passing a web URL with multiple arguments...it will pass the first but strip everything at and past the first '&' you supply.

URLs with 0 arguments: works

URLs with 1 argument: works

URLs with 2 or more arguments: fail due to missing 2nd, 3rd, nth argument

The website URL I am using works fine if I type it into a browser. I'm trying to get it passed as a command line to the associated browser via the shell.

When this code is executed, the browser brings up:

+ http://www.shrum.net/cats.php?body=/code/donations.shtml

Instead of:

+ http://www.shrum.net/cats.php?body=/code/d...shtml&dir=/code

Edited by sshrum

Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Share this post


Link to post
Share on other sites

this worked

$sAppDonations = "http://www.shrum.net/cats.php?body=/code/donations.shtml" & "dir=/code"

;$sAppDonations = "www.XPCleanMenu.HostRocket.com"
RunWait(@ComSpec & " /c " & "start " & $sAppDonations, "", @SW_MINIMIZE)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

There's a big difference between your line and the posted issue ... ;)

This demo's the issue that everyting gets cut off after the &:

$sAppDonations = "http://www.shrum.net/cats.php?body=/code/donations.shtml&dir=/code"

RunWait(@ComSpec & " /c " & "start echo " & $sAppDonations)

Don't have a real good solution but this works so maybe triggers ideas to get to the solution:

$sAppDonations = '"http://www.shrum.net/cats.php?body=/code/donations.shtml&dir=/code"'

RunWait(@ComSpec & " /c " & "start explorer " & $sAppDonations)

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

There's a big difference between your line and the posted issue ... :P

There is no need to "fix" - the proper arguments must be supplied to the command shell.

& is the 'command chain' operator in dos and dos-like shells (also *nix, from which dos derived

some of its most useful features ;)

i.e., from a command prompt type

date /t & time /t
both programs will run.

If I remember my dos, the solution is to "escape" the &, using the ^ operator. i.e.

echo this will not display the ampersand &
echo this will display the ampersand ^&
Edited by flyingboz

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

There is no need to "fix" - the proper arguments must be supplied to the command shell.

& is the 'command chain' operator in dos and dos-like shells (also *nix, from which dos derived

some of its most useful features ;)

i.e., from a command prompt type

date /t & time /t
both programs will run.

If I remember my dos, the solution is to "escape" the &, using the ^ operator. i.e.

echo this will not display the ampersand &
echo this will display the ampersand ^&
so.... in laymans terms ( other wise known as "hobbyist terms")

this is a valid approach or not a valid approach to the posters question ( it does work)

$sAppDonations = "http://www.shrum.net/cats.php?body=/code/donations.shtml" & "dir=/code"
RunWait(@ComSpec & " /c " & "start " & $sAppDonations, "", @SW_MINIMIZE)

?????

thx

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

If I test your url on the command line with iexplore:

It gives an error:

Parameter format not correct - "code".

Looks like your url is not acceptable, at least to IE...

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

@sshrum - glad to help

@valuater - The key, in my mind, whether you are a "hobbyist", or make a living programming ,

is whether you understand the issue, and the advantages / limitations of the proposed solution.


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

If I remember my dos, the solution is to "escape" the &, using the ^ operator. i.e.

Thanks for reminding the solution... I knew there was one but just couldn't remember it.. (guess the DOS stuff is slowly fading..)

so.... in laymans terms ( other wise known as "hobbyist terms")

this is a valid approach or not a valid approach to the posters question ( it does work)

$sAppDonations = "http://www.shrum.net/cats.php?body=/code/donations.shtml" & "dir=/code"
As mentioned: its not the same.

$sAppDonations = "http://www.shrum.net/cats.php?body=/code/donations.shtml" & "dir=/code"

results in $sAppDonations containing "http://www.shrum.net/cats.php?body=/code/donations.shtmldir=/code"

But the URL needed is :

"http://www.shrum.net/cats.php?body=/code/donations.shtml&dir=/code"

See the difference ? ;)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0