Computer Science Canada

: * problems with Sys.Exec

Author:  goroyoshi [ 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

Author:  Zren [ 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 ("").

Author:  goroyoshi [ Thu Apr 07, 2011 6:47 pm ]
Post subject:  RE:: * problems with Sys.Exec

but while using variables?

Author:  Tony [ 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.

Author:  goroyoshi [ 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

Author:  DemonWasp [ 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.

Author:  Raknarg [ 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.

Author:  goroyoshi [ Sat Apr 09, 2011 2:22 pm ]
Post subject:  RE:: * problems with Sys.Exec

quotes worked thank you

+1 karma to Zren


: