Sign in to follow this  
Followers 0
tlman12

How do you run a command with " in it

4 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

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


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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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?"

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