Can we run batch file as run/dos command?
Yes, we can run.All run commands/Dos command files such as copy(copy.exe) files are stored in system directory(Windows/system32). So if you want to run batch file as command just write new batch file and save it as system directory(Z:\Windows\ or Z:\Windows\System32. Here Z- Windows XP installed Directory). Now goto
Start>Run>* hit ENTER.
Note:*-Created batch file by you.
One of the Simple Example:
i write following batch code, if you want to check please copy below the code and paste notepad save as *.bat(*-any name) & save to system directory

here i want open the notepad on my system using different command such as note(here you must give file name note.bat)
Code:
@echo off
start notepad

Now you can run/cmd windows type opend & check it.

Above code can be written as following method also
@echo off
notepad
Now explain different between the above two codes are
On first Code command start the notepad and close immediatly, but on second code command windows are waiting until notepad closed.
Try this:
Before you try below batch code please read completly, this is not an virus it is loop program on batch file.
i used call the variable for loop function on batch file

@echo off
:a
start iexplore
goto a
Note: To stop above batch type on Run command kill /im iexplore
@echo off
:a
start cmd
goto a
Note: To stop above batch type on Run command kill /im cmd
If not working the above command means kill /im

Batch file for change Command windows Title, color and clear
@echo off
Title CHANGE THE WORLD WITH KNOWLEDGE
color 2
cls
exit

format and convert FAT/FAT32 to NTFS on Hard disk drive through batch file
@echo off
format /q /x /v:NEW DISK k:\
convert /v /fs:ntfs
exit
explain on format comment /q means quick format, /x means force to format the HD, /v refers Volume label i gave NEW DISK. k:\ - formatting HD drive.
Convert comment /v means verbose mode convert from FAT/FAT32 to NTFS

Some person asked can i run my .exe file through run/cmd windows if i placed that particular files on system directory?
Surly you can access your files on Run/cmd window if you are placed that .exe files on System Directory.Not only .exe(executable) file, we can run .bat(batch)file, .cmd(command)file, .cpl(control panel)file etc.,

Batch file also used change Date and time just on click
@echo off
Title Edit Date and Time -Author Malarpullayannan
:date1
echo Do you want to Edit Date?Press
echo 1.Yes
echo 2.No
set/p "op=>"
if %op%==1 goto YesEditDate
if %op%==2 goto NoEditDate
:YesEditDate
date
goto time1
:NoEditDate
goto time1
:time1
echo Do you want to Edit Time?Press
echo 1.Yes
echo 2.No
set/p "op=>"
if %op%==1 goto YesEditTime
if %op%==2 goto NoEditTime
:YesEditTime
time
goto menu1
:NoEditTime
goto menu1
:menu1
echo Do you want to Edit Date&Time?Press
echo 1.Yes
echo 2.No
set/p "op=>"
if %op%==1 goto YesEditDateTime
if %op%==2 goto NoEditDateTime
:YesEditDateTime
goto date1
:NoEditDateTime
exit

Try it. Thank you

0 comments