system() command on vista
| ekw | |||
| Hello, ive searched many times and i cannot find a solution to my issue. Im creating a program that starts on startup, launching programs after x seconds. But i have an issue when i use system()
when i dont use shortnames,
system("C:\\program files\\...")i get an error message C:\PROGRAM' is not recognized as an internal or external command, operable program or batch file. i cant use the shortname for windows sidebar because there are 8 other's that begin with window, and window~8 doesnt work goes up to ~4 any solution other than renaming things or launching shortcuts? Thanks for the help! | |||
| Grey Wolf | |||
you could try:
system("\"C:\\program files\\...\"")ie put \" at each end of your string. | |||
| soldstatic | |||
i think you need to escape the spaces. ie
system("C:\\program files\\...")becomes
system("C:\\program\ files\\...") | |||
| rpgfan3233 | |||
Grey Wolf's suggestion should work. I don't think escaped spaces shouldn't work in Windows because of the fact that '\' is the directory separator in Windows, and using the single '\' like that in C makes it think it is an escape sequence, which it isn't. In fact, gcc prints a warning when I use
system("dir C:\\Program\ Files");Output:
test.c:5:10: warning: unknown escape sequence: '\040'040 is the octal representation of the decimal number 32, which corresponds to the space character. Obviously that means it won't work either. Grey Wolf's suggestion works though:
system("dir \"C:\\Program Files\"");Output:
| |||
Registered users can reply in this forum.
