hromadne spusteni TrackIR, spusteni HyperLobby, spusteni TeamSpeak a pripojeni na server
potrebne programy:
vypis bezicich procesu - PsList
vyhledani retezce v textu - grep
jak to funguje ?
pslist.exe vypise spustene programy, preda je programu grep.exe, jenz se pokusi vyhledat retezec
(vyhledani ci nevyhyledani se projevi v parametru ERRORLEVEL po ukonceni behu programu, dle ktereho nasledne spustime nebo nespustime program)
co je ERRORLEVEL ?
ERRORLEVEL je promenna, do ktere se uklada informace o chybe naposled spusteneho programu (v pripade, kdy neni vracen zadny vysledek, naplni se ERRORLEVEL "jednickou" - v pripade, kdy je vse OK, zustava hodnota 0 )
hodnotu ERRORLEVEL lze zjistit prikazem
Code
echo %ERRORLEVEL%
script na spusteni TrackIR, HyperLobby a TeamSpeak, ktery si zkontroluje, zda programy jiz nebezi
Code
@echo off
REM script na hromadne spousteni procesu s kontrolou
REM ****************************************
REM jestli nebezi TrackIR, spust TrackIR
REM ****************************************
"C:\Program Files\PsTools\pslist.exe" |c:\bin\grep.exe TrackIR
IF ERRORLEVEL 1 START "TrackIR" "C:\Program Files\NaturalPoint\TrackIR4\TrackIR.exe"
REM ****************************************
REM jestli nebezi hlpro, spust hlpro
REM ****************************************
"C:\Program Files\PsTools\pslist.exe" |c:\bin\grep.exe hlpro
IF ERRORLEVEL 1 START "hlpro" /D "C:\Program Files\HyperLobbyPro3\" "C:\Program Files\HyperLobbyPro3\hlpro.exe"
REM ****************************************
REM jestli nebezi TeamSpeak, spust TeamSpeak
REM ****************************************
"C:\Program Files\PsTools\pslist.exe" |c:\bin\grep.exe TeamSpeak
IF ERRORLEVEL 1 START "TeamSpeak" /D "C:\Program Files\Teamspeak2_RC2\" "C:\Program Files\Teamspeak2_RC2\TeamSpeak.exe" "147.32.50.52:8769?nickname=JMENO?password=HESLO?channel=Gruppe Blau"
@echo on
uziti pro spousteni jinych programu
nejdriv si zjistete, jak je kazdy konkretni proces reprezentovan ve vypisu programu pres pslist.exe, retezec totiz nemusi odpovidat nazvu procesu ve spravci uloh
POZOR! grep.exe je citlivy na velka mala pismena
Upravil/a clone9cz dne 16-09-2008 19:22
IL-2 Sturmovik™, Cliffs of Dover™, Pacific Fighters™ are trademarks or registered trademarks of 1C EUROPE, 1C-Multimedia, 1C ONLINE GAMES.
Other marks used herein are those of their respective owners.