Sys.Exec with spaces
Author |
Message |
gitoxa
![](http://compsci.ca/v3/uploads/user_avatars/125344263047f801d546bcb.jpg)
|
Posted: Thu Apr 17, 2008 8:49 pm Post subject: Sys.Exec with spaces |
|
|
I'm trying to open up some files using the Sys.Exec command. Problem is, it can't find the file I'm trying to open. I realized that even though the variable with the filename in it had all the info, the Sys.Exec command only took up to the first space. I tested other files in the folder, without spaces, and they worked fine.
Any ideas how to get around this? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Dan
![](http://wiki.compsci.ca/images/archive/3/3c/20100325043407!Danspic.gif)
|
Posted: Thu Apr 17, 2008 9:05 pm Post subject: RE:Sys.Exec with spaces |
|
|
yes, you have to put files with spaces in ""s in the string.
So if i wanted to open somthing in notepad with a space in the name i would need to do somthing like this:
Sys.Exec("notepad.exe \"my text file.txt\"")
Assuming notepad.exe is in the systems path and my text file.txt is in the working dir. |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
![](images/spacer.gif) |
gitoxa
![](http://compsci.ca/v3/uploads/user_avatars/125344263047f801d546bcb.jpg)
|
Posted: Thu Apr 17, 2008 9:13 pm Post subject: RE:Sys.Exec with spaces |
|
|
The problem was I had it in a variable, and throwing quotations around one didn't seem like the best thing to do.
I got it though
code: | File := "\"" + File + "\"" |
Did that before putting it into Sys.Exec
Thanks. |
|
|
|
|
![](images/spacer.gif) |
|
|