Tech Support > Operating Systems > MS-DOS > Start another batch from login Script and end login Script
Start another batch from login Script and end login Script
Posted by Martin Braun on December 30th, 2003


Hello,
i want to start a batch file from login batch and the login Script can quit.

I hipe someone understood my problem and my English ;-))

See you,
Martin


My Problem:
The login script execute the next Command but don't quit
Can i use the exe.file for Script3 generate from the Bartch File Compiler?
Is the errorlevel the same as the batch file?

----------------------------------------------------------------------------
---
My solution:
Script 1: Generate a cmd Instanc
Script2: Control Script3 about Error
Script3: The working Script!


Login Script:

....
call script1.cmd
....


Script1:
@echo off
cmd /c "start /b /low script2.cmd"


Script2:
@setlocal
echo "Kontroll CMD"
cmd /c "script3.cmd" 1 > ".....dbg.txt" 2>&1

set test = OK

if %ERRORLEVEL%==0 goto keinFehler
set test = Fehler
:keinFehler

endlocal

Script3:
The script that do the work *g*




Posted by Herbert Kleebauer on December 31st, 2003


Martin Braun wrote:

Ich verstehe nicht wozu du script2.cmd und script3.cmd
benötigst. Schreib doch einfach deine Anweisungen aus dem
"The script that do the work *g*" in script1.cmd und vergiß
die beiden anderen. Falls das "Login Script" nach der
Ausführung von script1.cmd fortgesetzt werden soll ist
dein "call script1.cmd" richtig, ansonsten laß das call
vor script1.cmd weg.


Warum startest du eine neue cmd shell?

Gleich drei Gründe, warum "test " nie den Wert
" Fehler" haben kann (wozu eigentlich die Leerzeichen
in der Variablen "test " und dem Wert " Fehler"):

1. da du script2 in einer neuen cmd shell ausführts, wird
script1 die Variablen die script2 setzt nie zu sehen
bekommen

2. alle Änderungen zwischen setlocal ... endlocal sind
nach dem enlocal nicht mehr vorhanden

3. der Befehl "set test = OK" setzt den errorlevel auf 0
(sofern er in einer .cmd Datei ausgeführt wird, falls
du die Datei in .bat umbenennst, wird durch diesen
Befehl der errorlevel nicht verändert) somit wird
die Zeile "set test = Fehler" nie erreicht


Similar Posts