Batch files (2)
|
Apr 26, 2007
|
I created my first batch file last week. A batch file simply runs some DOS commands like starting programs or copying files. It's useful for executing repetitive tasks, such as renaming or backing up files. My batch file contains these commands: copy "c:\my documents\misc\imp.doc" docs copy "c:\my documents\misc\money.xls" docs The file resides on a USB stick and simply copies two files from My Documents to a folder called docs on the stick. The reference to My Documents has to be in quotes because it contains spaces. The reference to docs is an absolute path that refers to a folder on the stick. This is important because drive letters for USB devices will change depending on which USB port they're plugged in to. So if the batch file referred to "G:\docs", it would encounter an error if the USB stick wasn't plugged into the USB port that Windows calls "G:\". I found this link helpful for creating the batch file. #technology
|
Comments:
2007-04-30 19:00:30
Isn't docs a relative path, with the absolute path being more like g:docs ? (Where g is the assigned drive letter) That's how I interpret the wikipedia article, and what I always thought the terms meant. But anyway, I agree that batch files are fun, as are vb scripts. I find I like to use batch files for bulk file manipulation like you are doing, and scripts for anything where I have to read or write to the registry.
2007-05-01 07:59:29
Actually, docs is called a "root relative path" according to this site. So we're both right, but I'm less right.
|