Is there a way to write a batch file or something simple that will copy a file from one location to another, overwriting the old file there with no prompting?
I want something like this to do a simple backup of a couple locally-stored files on one of my boss' laptops, because he just lost some stuff and would really appreciate a solution like this, I think.
will overwrite without prompting. xcopy (which has more options) also supports this, but can copy directories and such. If you want to copy over a network, obviously you'll need to have some way of mounting the remote drive. If the Z: drive isn't in use on the machine, you can do that with something like:
net use z: \\computername\sharename password /USER:user /PERSISTENT:no
copy /y C:\Somedirectory\Somefile.ext Z:\Backups
net use z: /DELETE
If the remote host is UNIX and supports ssh/sftp, you can get rsync or scp for Windows or something to do it.
You can put anything you want in a batch file, just put it in a text file with extension .bat or .cmd. If you want to suppress the output of the actual commands, put:
Posts
will overwrite without prompting. xcopy (which has more options) also supports this, but can copy directories and such. If you want to copy over a network, obviously you'll need to have some way of mounting the remote drive. If the Z: drive isn't in use on the machine, you can do that with something like:
If the remote host is UNIX and supports ssh/sftp, you can get rsync or scp for Windows or something to do it.
You can put anything you want in a batch file, just put it in a text file with extension .bat or .cmd. If you want to suppress the output of the actual commands, put:
as the first line.
I've tried it down to the most basic (just the copy C:\directory\file.ext X:\other directory) and it still doesn't do shit.
I'm directing it to a mapped network drive; that should be okay, right? Or do I have to do something different?
Ah, I did not know that (the directory names have spaces in them, so I was putting spaces in them). Thanks!
Yeah I hate that about command-line. I normally just put the ' around them even if they don't so I don't have to deal with it.