Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch scripting

Status
Not open for further replies.

galorin

MIS
Nov 22, 2007
154
GB
I am wanting to script the following actions, in sequential order (Currently done in a cmd window)

C:\Program Files\TrueCrypt\TrueCrypt.exe /q /v c:\volume /lz /a

C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt.exe

"C:\Program Files\Microsoft Office\OFFICE11\msaccess.exe" "C:\Documents and Settings\RichardS\Desktop\database\contacts remote.mdb"

C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqladmin.exe -u root -prism6537 shutdown"

c:\Program Files\TrueCrypt\TrueCrypt.exe /q /d

Each one is dependant upon the previous command's completion. In the case of msaccess.exe, I need to wait until it ends before shutting down the server and unmounting the truecrypt volume. How can I accomplish this?

 
You could run each one as it's own independant batch script. Then start each in a 'master' batch script using the start with the /wait option. (start /? in a command prompt window for other options).

Also consider adding some error checking - think about some conditions that might wait forever (like if the mysql server is hung or already shutdown, or waiting for input or...)
 
I found a slightly more elegant solution in two scripts, one mounts truecrypt and one starts MySQL (As it's data directory is encrypted). Then the user can open up stuff in the encrypted drive, work it, and then close stuff out.

The second batch script closes out MySQL and then unmounts the truecrypt volume, but does it as you suggested using start and /wait.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top