set x=2 ok.
set x = 2 will not work.
REM use %% in a batch file for /l %x in (1, 1, 255) do ping /n 2 192.168.12.%x >> ping.txt
@echo off IF "%1"=="" GOTO bad IF "%1"=="x86" GOTO ok IF "%1"=="x64" GOTO ok :bad echo "parameter must be x86 or x64" goto end :ok echo using %1% :end
echo off echo %date% set year=%date:~10,4% set month=%date:~4,2% IF "%MONTH:~0,1%" == " " SET MONTH=0%MONTH:~1,1% set day=%date:~7,2% IF "%DAY:~0,1%" == " " SET DAY=0%DAY:~1,1% echo %time% set hour=%time:~0,2% IF "%HOUR:~0,1%" == " " SET HOUR=0%HOUR:~1,1% set minute=%time:~3,2% IF "%Minute:~0,1%" == " " SET Minute=0%Minute:~1,1% set ts=%year%-%month%-%day%_%hour%-%minute% echo %ts%
Sample usage
sqlplus jwars/password@jas @createJwarsTableCreationSql.sql > createJwarsTableCreationSql%ts%.log