Search This Blog

Wednesday 16 June 2010

Windows Tasks at shutdown

Open a Command Prompt window and determine the exact commands needed to copy the desired files. Use the XCOPY command, as it handles big files better than plain COPY. If you back up the same files every day, you can hard-code the full path for those files in the command. For each file you'd use a command like XCOPY /Y C:\BIG\BIG.DAT \\REMOTEPC\BACKUPS. The /Y command line switch automatically answers yes if XCOPY asks whether to overwrite an existing file having the same name. If you've mapped the network drive to a local drive letter, the command might look like XCOPY /Y C:\BIG\BIG.DAT G:\BACKUPS. It may be that the set of files that need backup changes every day. In that case, establish a folder that holds only those files and copy all files from that folder: XCOPY /Y C:\BIG\*.* G:\BACKUPS.
When you've verified the commands needed to back up your files, launch Notepad and enter those commands into a new document. Save it on the Desktop as "MyBackup.bat"—include the double quotes, so that Notepad won't be tempted to rename it MyBackup.bat.txt. Launch the batch file and verify that it does the job correctly. Now open it in Notepad again and add this command at the end of the file: SHUTDOWN -S -F -T 60 -C "Shutting down in 60 seconds"
Once the files have been copied, this line will start a 60-second countdown and then shut the system down. If you have a change of heart, quickly click Start, then Run, and type SHUTDOWN -A.