Jump to content

How do you run a command with " in it


tlman12
 Share

Recommended Posts

I'm trying to write a script

this is the syntax i want

Run(@COMSPEC & "rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /f %windir%\inf\ntprint.inf /r "IP_27.27.27.27" /m "HP Laserjet 4000 Series PCL" /Z")

i can do it with a send() command and it works, but then if the user accidently clicks the mouse it stops typing or types in what ever they accidently click into.

thats the exact syntax as you would type into a cmd prompt.

it needs to have the quotes but when U try it with the quotes it returns an error.

I've tried putting ' instead of " but that dosn't work eaither.

how would have to write this script?

Thanks for your help.

Edited by tlman12
Link to comment
Share on other sites

  • Developers

simple approach is to enclose the whole sting in single quotes in stead of Double quotes

Run(@COMSPEC & 'rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /f %windir%\inf\ntprint.inf /r "IP_27.27.27.27" /m "HP Laserjet 4000 Series PCL" /Z')

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

Start and end the string with single quotes. You can nest single quotes within double quotes.

EDIT: Jos beat me to it. Jos in the nick of time. Maybe I should Jos stop.

Edited by weaponx
Link to comment
Share on other sites

From Here:

Strings

Strings are enclosed in double-quotes like "this". If you want a string to actually contain a double-quote use it twice like:

"here is a ""double-quote"" - ok?"

You can also use single-quotes like 'this' and 'here is a ' 'single-quote' ' - ok?'

You can mix quote types to make for easier working and to avoid having to double-up your quotes to get what you want. For example if you want to use a lot of double-quotes in your strings then you should use single-quotes for declaring them:

'This "sentence" contains "lots" of "double-quotes" does it not?'

is much simpler than:

"This ""sentence"" contains ""lots"" of ""double-quotes"" does it not?"

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