problems with system("copy");



i try the following

string $source = “c:/test/test.jpg”;
string $dest = “c:/damn/”;
system (“copy “” + $source + “” " + “”” + $dest + “”");

but it dont work .

fif anyone know why? …

if i change the path from c:/test/test.jpg int c:\ est\ est.jpg it works … so maybe it is possible to convert the path –



First, DOS doesn’t use forward slashes. You can use forward slashes to define paths for MEL because Maya converts them internally as needed. But with the system command, you are speaking directly to DOS so you have to use it’s syntax.

Second, in order to define a backslash within a string in MEL, you have escape that character. The backslash IS the special chracter used by MEL to escape other characters as you have done with the " character. This is why specifying “\” will work.



Originally posted by X-Tender
… so maybe it is possible to convert the path –

It is, check out toNativePath command.


Wohoo … it works :stuck_out_tongue:


Hi !

I have a problem too, but only when i have a “space” in
my destination directory which is “Program Files” ,
Otherwise everything works well !

Any clue ?


You can specify DOS paths that include a space by encasing the entire path in quotes like so:

““c:\my crazy name\folder””



Many thanks bigfatMELon !
it works !:slight_smile:


You can also escape the spaces:

“c:\my\ crazy\ name\folder”

– Mark


Thank you Mark !


Ooookay i need a lil help right now… this is me :banghead: …I’m trying to run smedge from the system command this is my command line system(“c:\Program\ Files\smedge\smedge.exe”);

and this is my result…

Result: ‘C:\Program’ is not recognized as an internal or external command,

what gives?

Thanks all I read your book Mark…and aside from this lil hiccup it’s made mel very useful for me Kuddos my man.



system(“c:\Program\ Files\smedge\smedge.exe”);


system("“c:\Program\ Files\smedge\smedge.exe”");


system("“c:\Program Files\smedge\smedge.exe”");



The ~1 thing is a throwback to the old 8.3 naming standard. If you want, dir /x will give you the 8.3 equivalent to the long file name.


Thank ya sir! workin like a charm :wink:



you can also use Maya melcommand sysFile, instead of the system command… :slight_smile:

e.g. like this… -->

string $source = "c:/test/test.jpg";
string $dest = "c:/damn/";
sysFile -copy $dest $source;




This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.