Your file should look like the following: Similarly, you can automate this process if you right click on the file, create a shortcut, and put that shortcut into your “Startup” folder. Open Notepad and type the following on the first line: cd C:\ServerBackup and on the second line type: wget -r -k -p and save the file as ServerBackup.bat. This is also the location where the contents of the Web site are going to be backed up. Create a folder at C:\ServerBackup and extract the contents of Wget into it. You can download Wget from the Wget homepage. Wget will allow you to save a backup of every file of a Web site. You can automatically make a backup of a Web site by using batch scripting in combination with a third party program called Wget. Automatically backup a Web site using batch and Wget Whenever you log into Vista, the temp files from your previous session will be deleted. Your file should look like the following: Similarly, you can automate this process even more if you right click on the file, create a shortcut, and put that shortcut into your “Startup” folder. If you would like to automatically do this more frequently, open Notepad and type the following on the first line: cd C:\Users\%username%\AppData\Local and on the second line type: rmdir /S /Q Temp and save the file as removeTemp.bat. The Windows Vista Disk Cleanup Wizard does a nice job, however it does not delete your temp files unless they are over a week old. ![]() Now whenever you log into Vista, any files that you have modified will get automatically backed up, and never again will you unintentionally lose any data. You can automate this process even more if you right click on the file, create a shortcut, and put that shortcut into your “Startup” folder. In other words, it does not copy your entire hard drive every time you run it, it only copies files that have been changed. What is particularly convenient about this script is that after the first time you run it, it will only backup the files that have been changed. Save this file as “backup.bat,” and whenever you double-click the file it will backup the entire contents of your C: drive to your E: drive. If any of your drives have different letters, you will want to change them to match your drives. Open Notepad and type the following on the first line:cd c:\ and on the second line type: xcopy c: e:\backup /s /e /h /D and your file should look like the following: This command will copy the entire contents of your C: drive to a folder called “backup” in your E: drive. Let’s get to them… Note: This is a good place to mention that if you are ever executing a batch script and you would like to stop the sript before completion, hold “CTRL C” in the Command Prompt and the script will stop. You can probably imagine that batch scripting allows for the automation of some pretty powerful tasks. “Echo” is a very simple command to print text to the screen. Our sample file is printing “hello” and “the end” to the screen. It should look like the following: Open a Command Prompt session (Start > All Programs > Accessories > Command Prompt) and type “cd Desktop” and then “hello.bat” and your output will look like the following: When Vista executes a batch file, it executes one line at a time. On the first line of the file, type echo “hello” on the second line of the file type echo “the end” and resave your batch file. What is Batch Scripting?įirstly, as an introduction to batch scripting, create a sample batch file, open Notepad (Start > All Programs > Accessories > Notepad) and save the file as hello.bat onto your desktop. Additionally, this tutorial will show you how to backup a Web site using Wget and a batch script. ![]() This tutorial is an introduction to batch scripting in Windows Vista that will show you how to automatically back up your hard drive and delete your temp files without installing extra software. In theory, every task that you can complete in Windows using a GUI can be completed using a batch script. If you are unaware, batch scripts are files that are executed by the Command Prompt. ![]() Batch scripting is a powerful aspect of Windows.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |