Jump to content

Doing " " in the CMD line with AutoIt


Recommended Posts

I've tried to feed this command-

net localgroup "power users" "temp users" /add

...to Autoit and can't get past syntax errors. The quotes seem to keep freaking AutoIt out. If I do get it past AutoIt's syntax checker then the command does NOT work from the command line and I get errors.

Can anybody show the right way to get this command past the syntax checker???

Edited by autoitNOW
An ADVOCATE for AutoIT
Link to comment
Share on other sites

hi,

perhaps with Chr(34)

Good Luck,

Dre

Edited by Andre
What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!
Link to comment
Share on other sites

see faq 7, but here's the answers:

run('net localgroup "power users" "temp users" /add')

run("net localgroup ""power users"" ""temp users"" /add")

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

Thanks Emmanuel that does work.

I was also trying to use the command with (@ComSpec & " /k ") so that I could see the result. Which started me down the road of being freaked out with syntax and quotes.

Edited by autoitNOW
An ADVOCATE for AutoIT
Link to comment
Share on other sites

Hmmmm.... that doesn't seem to work. Plus in your example you hide it, which defeated my purpose of being able to see it. But thanks anyway....

RunWait(@ComSpec & " /k " & 'net localgroup [power users temp users {/add', "", @SW_MAXIMIZE)

An ADVOCATE for AutoIT
Link to comment
Share on other sites

Really. If you a working with the command line dont use " to enclose the data for Autoit use ' that will not force you using double "" that are very confusing.

In that case:

Run(@comspec & ' /c net localgroup "power users" "temp users" /add')

As you can see using ' makes anything much more easy and readable.

Link to comment
Share on other sites

Thanks Emmanuel that does work.

I was also trying to use the command with (@ComSpec & " /k  ") so that I could see the result.  Which started me down the road of being freaked out with syntax and quotes.

oh, ok, and I totally forgot about the @comspec part...

run(@comspec & ' /k net localgroup "power users" "temp users" /add')
run(@comspec & " /k net localgroup ""power users"" ""temp users"" /add")

and I'm with ezzetabi on using single quotes on the outside, much cleaner. just wanted to show you both options.

Edited by emmanuel

"I'm not even supposed to be here today!" -Dante (Hicks)

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...