windows C system call with spaces in command
Posted
by myforwik
on Stack Overflow
See other posts from Stack Overflow
or by myforwik
Published on 2010-04-15T03:26:01Z
Indexed on
2010/04/15
3:33 UTC
Read the original article
Hit count: 283
I cannot make system calls with spaces in the names and parameters. For example:
system("c:\program files\something\example.exe c:\my files\example.txt");
I have tried escaping in every way I know how, and NOTHING works. I have tried:
system("\"c:\program files\something\example.exe\" \"c:\my files\example.txt\"");
and
system("c:\program^ files\something\example.exe c:\my^ files\example.txt");
Neither work. I still get 'c:\program' is not a recongnised internal or external command
This is really driving me mad... I need to call and pass parameters that have spaces in them. I cannot use the short notation for reasons I won't go into.
I have tried with ' quotes instead of " quotes, still doesn't work. I have tried putting quotes around the whole thing and quotes around the spaces and that doesn't work.
Does anyone know how to do it properly?
© Stack Overflow or respective owner