The difference is that Xcopy.exe is an executable, while DEL is an
intrinsic command processor statement. That is, it is a command for
the Cmd.exe (or Command.com) program. Therefore, the command
processor needs to be invoked explicitly when using the Run method.
(The command processor is automatically invoked when it hosts the
'command line' console.)
Therefore, it must be use when using .Run as ...
execSTR = "%comspec% /c del " & srcfolderspec & "\*.WAV"
WshShell.run execSTR,0,true
or just to be safe, include the comspec in the Run statement ...
execSTR = "del " & srcfolderspec & "\*.WAV"
WshShell.run "%comspec% /c " & execSTR,0,true
Then you don't need to 'know' whether it's an intrinsic command or an
executable.
Tom Lavedas
===========
Quote:
> When using WshShell.Exec or WshShell.run I have a strange
> problem where I can use it to do something like:
> execSTR = "xcopy " & srcfolderspec & "\*.WAV" & " " & Path
> WshShell.run execSTR,0,true
> and that works but then if I issue:
> execSTR = "del " & srcfolderspec & "\*.WAV"
> WshShell.run execSTR,0,true
> It throws an error. I can pop a msgbox and see the whole
> string and then type that string myself into a command
> prompt window and it works fine. What is the difference
> bettween the wshshell doing the execute and my self doing
> it from the command line?