Batch syntax
Verfasst: Do 27. Sep 2018, 08:11
In einer Batch zur Wochentags-Abfrage sind ^. ich habe versucht den bestimmten Befehl ohne diese ( und den Rest zu starten) um es besser zu verstehen. SPOILER ALERT: Ich verstehe es immer noch nicht!!
Hier der Befehl und das ganze Programm:
---------------------------------------------------------------------------------------------------
wmic path win32_localtime get dayofweek^|findstr /v /r "^$"'|findstr /v /r "^$"'
---------------------------------------------------------------------------------------------------
:: @echo off
setlocal
set DOW=
for /f %%g in ('wmic path win32_localtime get dayofweek^|findstr /v /r "^$"'|findstr /v /r "^$"') do (
set DOW=%%g)
if %DOW%==0 set DOW=So
if %DOW%==1 set DOW=Mo
if %DOW%==2 set DOW=Di
if %DOW%==3 set DOW=Mi
if %DOW%==4 set DOW=Do
if %DOW%==5 set DOW=Fr
if %DOW%==6 set DOW=Sa
for %%i in (Mo,Di,Mi,Do,Fr) do (
if "%DOW%"=="%%i" goto EOF
)
:NO
shutdown -s -t 180
goto EOF
:EOF
endlocal
exit
Hier der Befehl und das ganze Programm:
---------------------------------------------------------------------------------------------------
wmic path win32_localtime get dayofweek^|findstr /v /r "^$"'|findstr /v /r "^$"'
---------------------------------------------------------------------------------------------------
:: @echo off
setlocal
set DOW=
for /f %%g in ('wmic path win32_localtime get dayofweek^|findstr /v /r "^$"'|findstr /v /r "^$"') do (
set DOW=%%g)
if %DOW%==0 set DOW=So
if %DOW%==1 set DOW=Mo
if %DOW%==2 set DOW=Di
if %DOW%==3 set DOW=Mi
if %DOW%==4 set DOW=Do
if %DOW%==5 set DOW=Fr
if %DOW%==6 set DOW=Sa
for %%i in (Mo,Di,Mi,Do,Fr) do (
if "%DOW%"=="%%i" goto EOF
)
:NO
shutdown -s -t 180
goto EOF
:EOF
endlocal
exit