Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Sys.Exec with spaces
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
gitoxa




PostPosted: 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?
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: 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!
gitoxa




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: