Jump to content

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


sshrum
 Share

Recommended Posts

$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'

 

Link to comment
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)

its in your web indentification

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

(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'

 

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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.

Link to comment
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

Link to comment
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.

Link to comment
Share on other sites

  • Developers

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 ? ;)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...