See Previous post before it
start : The "start" command can launch a Windows program either by specifying the program name or by specifying a data file name that is associated with a particular program (one that would automatically launch if you clicked on it in Windows).
options :
minimized - /m
maximized - /max
restored - /r
wait - /w
ex :
start notepad.exe
will open notepad
start C:\new.doc
will open the file Myletter.doc in Word or WordPad
start http://www.facebook.com
will open Facebook page in your browser
copy : one more powerful command...
Syntax : COPY [source] [destination] [options]
Key : destination : Pathname for the new destination files
source : Pathname for the file or files to be copied.
/A : ASCII text file (default)
/B : Binary file copy
/V : Verify : check that the new files were written correctly.
/Y : No confirmation prompt
Ex :
copy oldfile.doc newfile.doc
copy in the current folder
goto : used to jump from one line to other without any condition.... idol for Virus....
Syntax : goto label
......................
......................
......................
......................
: label
Control jumps to label skipping the in between lines.... label may be located before or after goto.....
Key label : a predefined label in the batch program. Each label must
be on a line by itself, beginning with a colon.
To exit a batch script file or exit a subroutine specify goto:eof this will transfer control to the end of the current batch file. Unlike Exit /b the goto:eof will automatically set an errorlevel.
what if a batch file with following code :
@echo off
:loop
start notepad.exe
goto loop
it is a small VIRUS.... it will start infinite notepad windows.... as loop doesn't end... never try in your own pc...
u have to direct off your computer to terminate it....... :P
for : Repeats a task or command based on a condition.... the argument take list value each time....
Syntax :
for %%argument in (list) do command
Key : Argument : any letter from A to Z.
List: a sequence of strings separated by spaces or commas...
Ex :
for %%d in (A,C,D) do DIR %%d *.*
Displays the directories of drives A, C, and D sequentially.
for %%f in (*.TXT *.BAT *.DOC) do TYPE %%f
Types the contents of all .TXT, .BAT, and .DOC files in the current default directory.
for %%P in (%PATH%) do if exist %%P\*.BAT COPY %%P\*.BAT C:\BAT
Copies all batch files which exist in any directory on the DOS command search path into the directory C:\BAT.
pause : PAUSE Pauses the running of a batch file and displays the message "Press any key to continue ..." on the screen. If the optional message is included, it will be displayed first.
syntex : pause [message]
Ex :
pause < nul
Waits with no comment.
pause Do you want to continue?
Displays "Do you want to continue?" with "Press any key to continue ..." on the next line.
cls : Clears the terminal screen, setting the cursor in the upper left-hand corner...
echo on ---- Restores normal display activity.
echo off ---- Halts display of prompt and commands.
No comments:
Post a Comment