Hello,
i want to ceat an batch file, which can recognize an shutdown. After this the batch file have to cancel the shutdown. At least the batch have to oben a Excel file.
I have no idea, how i can recognize an shutdown or how i can cancel a shutdown. Can somebody help me please.
Thx.
Greets Heiti
Shutdown recognize, cancel and file start
Moderator: DosItHelp
Re: Shutdown recognize, cancel and file start
I'm not sure how to recognise a shutdown, but they can be cancelled by administrators using:
phillid
Code: Select all
shutdown -a
phillid
Re: Shutdown recognize, cancel and file start
Hey thx for your help. I try to do it with this Code:
I open the batch file with an entry in the microsoft managment cosole.
Thank you all for your help.
Greets Heiti
P.S.: Sry about the German comments
Code: Select all
@echo off
:START
cls
REM -----Variablen erstellen
SET datum=%DATE%
SET datum_alt=
REM ----------------------------------
REM -----Variablen vorbelegen
REM -----Textdatei DB.txt öffnen, Zeile auslesen und das Datum in die Variable "datum_alt" schreiben
FOR /f %%f IN (DB.txt) DO @SET datum_alt=%%f
REM ----das aktuelle Datum in die Textdatei schreiben
ECHO %datum% >DB.txt
REM echo %datum%
REM echo %datum_alt%
REM echo %time%
REM ping 127.0.0.1 -n 10>nul
REM echo 10 sec später
REM -----Überprüfen ob der Rechner heute schon mal gestartet wurde.
IF %datum_alt% == %datum% GOTO :ENDE
REM -----Exel-Tabellestarten wenn der Rechner heute noch nicht hoch gefahren wurde
echo Stundenerfassung - Herunterfahren abgebrochen starten
%SystemRoot%\system32\shutdown.exe -a
Stunden_2012.xls
GOTO :Absolut
:ENDE
echo Stundenerfassung nicht starten
echo %time%
ping 127.0.0.1 -n 5 > nul
echo 5 sec später
:Absolut
I open the batch file with an entry in the microsoft managment cosole.
Thank you all for your help.
Greets Heiti
P.S.: Sry about the German comments