Computer Science Canada Using Sys.Exec with spaces |
Author: | LegendsEnd [ 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? |
Author: | Tony [ Mon May 22, 2006 8:01 pm ] | ||
Post subject: | |||
I'm think that it has to be in quotations, like
|
Author: | LegendsEnd [ Mon May 22, 2006 8:26 pm ] | ||
Post subject: | |||
I'm confused as to what you're saying. Right now I have code that looks like this:
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. |
Author: | [Gandalf] [ Mon May 22, 2006 8:59 pm ] |
Post 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". |
Author: | LegendsEnd [ Mon May 22, 2006 9:24 pm ] |
Post subject: | |
Ah I see, thanks, got it working. Forgot that the \ allows characters like " ' ^ |