Simple DOS command syntax issues

Simple DOS command syntax issues

Anonymous
Not applicable
1,612 Views
8 Replies
Message 1 of 9

Simple DOS command syntax issues

Anonymous
Not applicable

Hi 2 simple tasks stuck on both!

 

delete all *.mse files in a directory

DOSCommand "delete  "V:\!3id scripts\*.mse" /s /q"

 

doesnt work?

 

 

the other one is simple copy a directory and all contents from one locationto another

Doscommand "XCOPY "C:\scripts" "V:\!3id scripts""

 

Thanks for any help

 

0 Likes
1,613 Views
8 Replies
Replies (8)
Message 2 of 9

blakestone
Collaborator
Collaborator

try this... using HiddenDosCommand does it quietly so you do not need to include /q

 

HiddenDosCommand "del v:\\!3id scripts\\*.mse /s"

 

0 Likes
Message 3 of 9

Anonymous
Not applicable

Thanks Hidden command is great but I still have problems with syntax and it seems to be with how the path is expressed

 

in a CMD window if i type

del "V:\!3id scripts\*.mse" /s - (I have included the path as a string in "" )

all is good and it works however

 

when I use the same in Maxscript

HiddenDosCommand "del "V:\!3id scripts\*.mse" /s"

 

I get this error:

-- Error occurred in anonymous codeblock; filename: S:\!3iD BETA\copy and delete.ms; position: 444; line: 13
-- Syntax error: at bad, expected <keyword arg>
-- In line: HiddenDosCommand "del "V:\!

 

 

I have tried using string literals \" still no luck...any clues?

thanks

Mike

 

 

 

 

 

0 Likes
Message 4 of 9

blakestone
Collaborator
Collaborator

You need to double your back-slashes when using them in strings...

 

incorrect: c:\windows\system32\

 

correct: c:\\windows\\system32\\

 

Also if you want to use quotes in strings you need to add a back-slash...

 

incorrect: "del "c:\windows\system32\" /s"

 

correct: "del \"c:\\windows\\system32\\\" /s"

0 Likes
Message 5 of 9

Anonymous
Not applicable

Hi,

Thanks yes "//" was an issue

but the problem appears that the path has a space in it, (dos evaluates this as a return)

ie C:\\3id scripts

so to get this to work in Dos the path needs to be in ""

the issues is when the path is nested  in a second  set of quote marks Max is not evaluating it

 

"del "V:\\!3id scripts\\*.mse" /s"

 

 

0 Likes
Message 6 of 9

Anonymous
Not applicable

sorry just posted then read your post properly...

thanks all is good

 

0 Likes
Message 7 of 9

Anonymous
Not applicable

I am back----checked again still more problems

 

DOSCommand  "del \"V:\\!3id scripts\\*.mse\\\" /s"   

syntax evaluates fine

returns a "1" in the listenor but problem is it still does not actually delete?

 

when I use the same string in CMD

ie del "V:\!3id scripts\*.mse" /s

 

all is fine is it a permissions issue?

 

 

 

0 Likes
Message 8 of 9

blakestone
Collaborator
Collaborator

try this...

 

DOSCommand  "del \"V:\\!3id scripts\\*.mse\" /s"  

 

Message 9 of 9

Anonymous
Not applicable

Thanks solved

 

amazing how such a simple thing when you are learning can take hours of time!