Copy command not working from script



Hi,

I wrote a script to copy a file from one drive to another

Dim oShell, oExec, sSyntax, nreturn
Set oShell = CreateObject("Wscript.Shell")
sSyntax = "copy c:file1 d:file2"
nreturn = oShell.Run(sSyntax)
Wscript.Echo nreturn

I get a error "System cannot find the file specified"

but if I give the same command from command prompt it works fine.
i tried with "ofs.copyfile" its working fine but i need to use "copy"
command try
any one has the same issue. If any one has resolved it or has any
suggessions please let me know.

.



Relevant Pages

  • Re: Copy command not working from script
    ... Dim oShell, oExec, sSyntax, nreturn ... but if I give the same command from command prompt it works fine. ...
    (microsoft.public.scripting.wsh)
  • Re: Copy command not working from script
    ... Dim oShell, oExec, sSyntax, nreturn ... Set oShell = CreateObject ... assumes the current folder on both drives are set to the ones needed. ...
    (microsoft.public.scripting.wsh)
  • Copy command not working from script
    ... Dim oShell, oExec, sSyntax, nreturn ... Set oShell = CreateObject ... but if I give the same command from command prompt it works fine. ...
    (microsoft.public.scripting.vbscript)
  • Re: Copy command not working from script
    ... this uses the command prompt to execute the copy command. ... Dim oShell, oExec, sSyntax, nreturn ... but if I give the same command from command prompt it works fine. ...
    (microsoft.public.scripting.vbscript)
  • Re: Copy command not working from script
    ... Set oShell = CreateObject ... Wscript.Echo nreturn ... command try ... suggessions please let me know.- Hide quoted text - ...
    (microsoft.public.scripting.wsh)