Ping with notyfy (win xp)
:zacatek
ping -n 1 -w 5000 192.168.231.160
goto zprava%ERRORLEVEL%
:zprava1
sndrec32 /play /close "C:\Windows\Media\Notify.wav"
goto zacatek
:zprava0
echo ok
ping 1.1.1.1 -n 1 -w 3000 > nul
goto zacatek
Checking remote command fail using putty predefined record
:zacatek
cd "C:\program files\putty"
putty -load ah-db-temp
goto zprava%ERRORLEVEL%
:zprava1
sndrec32 /play /close "C:\Windows\Media\Notify.wav"
goto zacatek
:zprava0
echo ok
goto zacatek
simple for cycle
for %%i IN (*.wav) do lame -v -b 160 %%i %%i.mp3
OS and CPU architecture detect sample, registry change sample
@Echo off
IF %OS%==Windows_NT Goto WinNT
:Win9x
CLS
Echo Windows 9x or ME Detected.
Echo Windows is in : %winbootdir%
%winbootdir%\regedit.exe /s Win9x\win9x.reg
Goto End
:WinNT
CLS
Echo Windows NT or 2000 Detected.
Echo Windows is in : %windir%
IF %PROCESSOR_ARCHITECTURE%==x86 Goto Intel
Goto Alpha
:Intel
Echo Intel CPU detected.
%windir%\regedit.exe /s WinNT\winnt.reg
Goto End
:Alpha
Echo Alpha CPU Detected.
Goto End
:End
pause
exit
Passing arguments safely
rem Pass arguments through a file to avoid overflowing the command line.
:top
echo %1 >>"%TEMP%\_.at"
shift
:bot
rem Search for leading '-'
echo %1 | findstr /b /C:- >nul 2>&1
if ERRORLEVEL 1 goto proc
goto top
:proc
call "another.bat" %1 %2
|