: * problems with Sys.Exec
Author |
Message |
goroyoshi
![](http://compsci.ca/v3/uploads/user_avatars/13875868514dae1bcc8da17.png)
|
Posted: Thu Apr 07, 2011 6:33 pm Post subject: : * problems with Sys.Exec |
|
|
Turing: |
var filename : string
get filename : *
if not Sys.Exec (filename ) then
put "Error, " ..
put Error.LastMsg
end if
|
why won't it let me put spaces for this? and is there a way to put spaces here |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Zren
![](http://compsci.ca/v3/uploads/user_avatars/1110053965512db6185954b.png)
|
Posted: Thu Apr 07, 2011 6:43 pm Post subject: RE:: * problems with Sys.Exec |
|
|
Open up Command Prompt and type a filename with spaces. It'll error out.
In order to do that you need to surround the filename with quotes (""). |
|
|
|
|
![](images/spacer.gif) |
goroyoshi
![](http://compsci.ca/v3/uploads/user_avatars/13875868514dae1bcc8da17.png)
|
Posted: Thu Apr 07, 2011 6:47 pm Post subject: RE:: * problems with Sys.Exec |
|
|
but while using variables? |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Thu Apr 07, 2011 7:26 pm Post subject: RE:: * problems with Sys.Exec |
|
|
The variable is fine
code: |
var filename : string
get filename : *
put filename
|
but commands are delimited by whitespace, so it's not valid to have spaces in filenames. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
goroyoshi
![](http://compsci.ca/v3/uploads/user_avatars/13875868514dae1bcc8da17.png)
|
Posted: Fri Apr 08, 2011 11:03 am Post subject: RE:: * problems with Sys.Exec |
|
|
some of my folders have spaces, so this will be a problem |
|
|
|
|
![](images/spacer.gif) |
DemonWasp
|
Posted: Fri Apr 08, 2011 12:40 pm Post subject: RE:: * problems with Sys.Exec |
|
|
In Windows, there's a way to specify a folder name that has spaces in it without including spaces in the path. In fact, there are two ways.
First, you can put double-quotes around the path. Some programs that do naive parsing have a problem with this, wherein they ignore the quotes, or worse, decide that the quotes are part of the path.
Second, you can use the "short form" of a file name, as these are guaranteed to never contain spaces, and uniquely determine a longer "user-friendly" file name. To find out the short form, you can use dir /x in the parent directory, assuming you know the path ahead of time. Using this strategy, "C:\Program Files\" becomes "C:\PROGRA~1\". If you don't know the path ahead of time, you can't really use this approach. |
|
|
|
|
![](images/spacer.gif) |
Raknarg
![](http://compsci.ca/v3/uploads/user_avatars/3745510004d8be6689b92f.jpg)
|
Posted: Fri Apr 08, 2011 3:26 pm Post subject: RE:: * problems with Sys.Exec |
|
|
If the file you're calling is in the same folder as the turing save, you should only need to put the name of that file. |
|
|
|
|
![](images/spacer.gif) |
goroyoshi
![](http://compsci.ca/v3/uploads/user_avatars/13875868514dae1bcc8da17.png)
|
Posted: Sat Apr 09, 2011 2:22 pm Post subject: RE:: * problems with Sys.Exec |
|
|
quotes worked thank you
+1 karma to Zren |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|
|