View Full Version : printing text with " "

03 March 2009, 03:31 PM
In my script I want to print the render.exe path into a .bat file.

At the moment the script line looks like this:

print ("Render -r mi -binary 0 -cam " + $camera + " " + $selectedScenes[$i] + "\r");

This works fine and prints the correct text into my file however I need to print the full path of the Render executable. In order for it to render it needs to look like this at the start:

"C:\Program Files\Autodesk\Maya2008\bin\Render.exe"

However when I try and insert this into the script. eg

print (""C:\Program Files\Autodesk\Maya2008\bin\Render.exe" -r mi -binary 0 -cam " + $camera + " " + $selectedScenes[$i] + "\r");

I get a syntax error. It doesn't seem to like the two "" at the start.

How can i fix this.



03 March 2009, 04:37 PM
If you want to use double quotes inside a string you have to escape it, like you did with the \r.

print( "\"quote\"" ) will output "quote".

03 March 2009, 04:43 PM
when using quotes inside of quotes you need to escape them with a \ like this " \"some text\" "

[edit] - bah beat me to it, what ticket said :P

03 March 2009, 04:52 PM

thanks guys :)

CGTalk Moderation
03 March 2009, 04:52 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.