How to Outlook

Aug 28, 2012

How to Create a Batch File in Windows XP

Batch files are simple text files that help you execute several repetitive actions without navigating much, saving your precious time and efforts. For example, you can back up and sync the changes from one folder to another using a simple two-line command, manually install the latest Windows updates at once, list all the files at once in a folder, delete a file or folder automatically, change a file’s attributes, and shut down and restart your computer etc. Check the steps given below and create a batch file to sync it with another batch file. (See Also Windows XP support)
1. Right-click the Start button> click Explore. In Windows Explorer, click Local Disk C: drive under My Computer. Make sure you can see contents of both the Desktop and C: drive. Leave Windows Explorer opened. Click the Start button> All Programs, Accessories> Notepad.
2. A new Untitled – Notepad window will open up. Type ‘md c:\testsource’  (without quotes) and hit Enter. Type ‘md c:\testbackup’ and hit Enter. Press the Ctrl + S keys together to save the Notepad file. Give a name to the file like copy.bat> choose a location like C: drive, and click Save to save the file in the C directory. (See Also how to make Windows 7 look like XP)
3. You must use .bat as the extension to the file name. Exit the Notepad window. Browse to the C: drive and you will see two directories namely testbackup and testsource there. Delete the copy.bat file now from the C:\ drive. Double-click the testsource directory to open it. (Find Here how to fix corrupt Windows XP files)
4. We will now create some dummy files in this directory. Right-click anywhere on the blank space in the directory, click NewText Document. It will open up the New Text Document window. Save the Notepad file and give it a desired name and then click Save. (I am naming this file as testdoc1 for reference purpose)
5. You will see the testdoc1 in the testsource directory. When done, right-click again anywhere on the white space and click Bitmap Image. Save this file as testbit1 (any desired name that you can recognize easily). Now you will need to create another batch file to automatically copy the contents of the testsource directory to testbackup. (See Also how to fix Invalid boot.ini error in Windows XP)
6. Now open another Notepad and type ‘@echo off’ and hit the Enter key. Type ‘xcopy c:\testsource c:\testbackup /m /e /y’ and hit Enter. Make sure that you type every command without quotes. Save this Notepad file as backup.bat or by any other desired name on the Desktop. When done, exit the Notepad window and look for the backup.bat file on Desktop. (Find Here how to install Windows 7 on XP)
7. Double-click the file to run the script. You will see the Command Prompt flashing once. Now go to the C: drive and look for the testbackup folder. You will see two copies of the files you previously created in the testsource directory. You can copy or add contents to your testsource directory and they will automatically reflect in the testbackup directory in real time. You can now copy your important files, folders, and photos etc. to the testsource directory and they will immediately back up in the testbackup directory. Besides, you can copy the contents of your data backup to a CD or USB flash drive for backup and restore purpose.
8. If you want to delete a folder or file without being prompted by Windows for permission, open Notepad and type ‘rd /s /q foldername’ and hit Enter. Save the file and give it a desired name. Close Notepad. Double-click the file that you just created. Click the Start button and then navigate to the C drive. You will no longer see the particular folder as it has been deleted. (Find Here how to reinstall TCP/IP stack in Windows 7)


Post a Comment

Comprehensive Support