How to create batch file
By Sergey Skudaev
Here you will learn How to create batch file to start an executable in command prompt. Why you want to create batch file. Let imagine that you install Tomcat in "C:\jakarta-tomcat-4.1.29" folder. Then to start Tomcat you have to open command prompt. Usually it opens in "C:\WINDOWS" or "C:\Documents or Settings\< user>" folder. So, you have to type cd.. and press enter to get to C:\> directory, then type cd jakarta-tomcat-4.1.29\bin to get to bin directory. It takes time. Besides, can you remember "jakarta-tomcat-4.1.29"?. I cannot.
It is much easier to open command prompt and type start_tomcat and Tomcat starts. You have to know DOS command to write batch files, so you will learn how to use DOS"
If your MySQL database installed on C: drive and your command prompt Opens in D:\WINDOWS or C:\WINDOWS, each time you want to start MySQL You have to type many command to get to C:\MySQL\bin directory.
In my example, I type C: and press enter to switch to C: drive. I expecting to get to C: root directory, instead I get in directory where my notebook wireless adapter installed, because I executed my adapter to connect to Internet.
Now to get to root directory, I have to type cd.. and press enter three times.
C:\Program Files\Linksys\Wireless-B Notebook Adapter>cd..
Then to get to MySQL/bin directory, I have to type:
Then to start MySQL I have to type mysqld for WINDOWS 98, ME or mysqld-nt for WINDOWS 2000.
Then to get to MySQL user interface I have to type MySQL:
You can save your time if you create a batch file with following script
and save it in D:\WINDOWS directory with the name start_mysql.bat Why in D:\WINDOWS? Because command prompt window opens with the path to this directory (on my PC). On yours it may be different, then you have to save this file in your directory. Then you can open command prompt and type: start_mysql and press enter. MySQL user interface displays. If my Tomcat path is C:\ jakarta-tomcat-4.1.29\bin then to start Tomcat I have to create start_tomcat.bat batch file with following script:
The startup.bat batch file that goes with Tomcat distributable is located in bin directory. It will be executed and Tomcat starts. To shut down Tomcat just type shutdown. Because you are already in bin directory shutdown.bat file will be executed and Tomcat shuts down.
Did you find information useful?
Send to your friend a link to this page
Please rate the tutorial
My eBooks on Amazon.com3>
That's right what you have written above, but if you have to create batch files quite often you'd better use Dr.Batcher (http://www.drbatcher.com) to make them.
- Batch Files
- Java Properties
- Form Validation
- Display Image PHP
- Upload File PHP
- Environment Variables
- Database Design
- PHP + Oracle 1
- Password Keeper
- MySQL and Excel
- Learn MySQL
- Learn SQL
- Learn PHP
- Learn C++
- Learn Java
- Learn Visual Basic
- VB Form Events
- Web Site Tips
- User_Auth. Demo
- Delete Trojan horse
- Convert Audio Files
- Search Files
- Advertise here
- Site map