22-05-2010, 10:54 PM
Useful batch commands
STEP ONE:
In this tutorial you will be learning how to use the following commands:
cd
copy
del
start
STEP TWO:
cd
The cd command is used to navigate to a directory.
For example, if you wanted to navigate to be the desktop the command would be:
cd "%userprofile\Desktop%"
This command is one of the more useful ones to know because it needs to be used in conjunction with the other commands.
STEP THREE:
copy
The copy command allows you to copy a file from one directory to another.
Before you are able to use the copy command, you need to know how to use "cd", this is because you need to be in the directory from which you want to copy the file from.
When using the copy command you need to use it in the following way:
copy "filename" "chosen path to copy the file to"
Where it says "filename", replace it with the name of the file you want to copy and where it says "chosen path to copy the file to", replace that with the directory of where you want the file to be copied to.
For example, if you've got a file called copy.txt that you want to copy to the desktop the code would be:
copy copy.txt "%userprofile%\Desktop"
STEP FOUR:
del
This del command is used to delete things, it can be used to delete single files or an entire hard drive.
Similar to the copy command, for the "del" command to work you need to cd into the directory where the file is.
When using the del command it takes the following structure:
del "filename"
Where it says "filename" replace that with the name of the file you want to delete.
For example, if you wanted to delete the file delete me.txt then the command would be:
del "delete me.txt"
STEP FIVE:
start
The start command is used to start or open something, it can be a file or a program.
Just like the copy and del commands, for the start command to work you'll need to select a directory using the "cd" command.
Once the directory has been selected you type:
start "filename.extension"
Where it says "filename" replace that with the file you want to start / open - and where it says ".extension" replace that with the file type, eg .exe or .txt
For example, to start Internet Explorer you type:
start iexplore.exe
I hope this has helped.
STEP ONE:
In this tutorial you will be learning how to use the following commands:
cd
copy
del
start
STEP TWO:
cd
The cd command is used to navigate to a directory.
For example, if you wanted to navigate to be the desktop the command would be:
cd "%userprofile\Desktop%"
This command is one of the more useful ones to know because it needs to be used in conjunction with the other commands.
STEP THREE:
copy
The copy command allows you to copy a file from one directory to another.
Before you are able to use the copy command, you need to know how to use "cd", this is because you need to be in the directory from which you want to copy the file from.
When using the copy command you need to use it in the following way:
copy "filename" "chosen path to copy the file to"
Where it says "filename", replace it with the name of the file you want to copy and where it says "chosen path to copy the file to", replace that with the directory of where you want the file to be copied to.
For example, if you've got a file called copy.txt that you want to copy to the desktop the code would be:
copy copy.txt "%userprofile%\Desktop"
STEP FOUR:
del
This del command is used to delete things, it can be used to delete single files or an entire hard drive.
Similar to the copy command, for the "del" command to work you need to cd into the directory where the file is.
When using the del command it takes the following structure:
del "filename"
Where it says "filename" replace that with the name of the file you want to delete.
For example, if you wanted to delete the file delete me.txt then the command would be:
del "delete me.txt"
STEP FIVE:
start
The start command is used to start or open something, it can be a file or a program.
Just like the copy and del commands, for the start command to work you'll need to select a directory using the "cd" command.
Once the directory has been selected you type:
start "filename.extension"
Where it says "filename" replace that with the file you want to start / open - and where it says ".extension" replace that with the file type, eg .exe or .txt
For example, to start Internet Explorer you type:
start iexplore.exe
I hope this has helped.