Using Sys.Exec with spaces
Author |
Message |
LegendsEnd
|
Posted: Mon May 22, 2006 7:11 pm Post subject: Using Sys.Exec with spaces |
|
|
Using the Sys.Exec command, can the file I'm trying to run have spaces? If so, am I supposed to put an asterisk somewhere? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Mon May 22, 2006 8:01 pm Post subject: (No subject) |
|
|
I'm think that it has to be in quotations, like
code: |
Sys.Exec("\"documents and settings\file\"")
|
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
LegendsEnd
|
Posted: Mon May 22, 2006 8:26 pm Post subject: (No subject) |
|
|
I'm confused as to what you're saying. Right now I have code that looks like this:
code: |
if not Sys.Exec("A Document.doc") then
put "Failed"
end if |
When I try it as "ADocument.doc" it works, with the space however it doesn't.
I have tried "A" + chr(32) + "Document.doc" which doesn't work, I have also tried making a string that stores "A Document.doc" and using that as the parameter but it doesn't work either. |
|
|
|
|
|
[Gandalf]
|
Posted: Mon May 22, 2006 8:59 pm Post subject: (No subject) |
|
|
Tony is using an escape character: \ to add a quote to the argument. If you don't understand this, I'd suggest looking the subject up specifically (ie. escape characters).
We need a quote in the argument since without it the console will take "A" and "Document" as two seperate arguments because they are split up by a space. When you put quotes around the whole argument, you are telling the console that it is all one big argument: "A Document". |
|
|
|
|
|
LegendsEnd
|
Posted: Mon May 22, 2006 9:24 pm Post subject: (No subject) |
|
|
Ah I see, thanks, got it working. Forgot that the \ allows characters like " ' ^ |
|
|
|
|
|
|
|