以前总是写shell,现在写个bat脚本,发现它比shell弱很多,我找不到 逻辑与,或, 非。 ||, && 但是能用goto实现。
以下是个bat脚本,因为我把所有service都设置成为手动。所以要bat实现启动oracle10 : listner and service.
@echo off
echo %1 ...
rem james
rem version 1.0
set ORACLE_HOME=G:/oracle/product/10.1.0/db_1
set ORACLE_SID=oracle10
set PATH=%ORACLE_HOME%/bin;%PATH%;.
if "%1"=="start" goto yess
if "%1"=="stop" goto yesMan
if not "%1"=="stop" goto noo
if not "%1"=="start" goto noo
end
:yess
echo ------- %1 tnslsnr--------
net %1 OracleOraDb10g_home1TNSListener
echo ======= %1 service=========
net %1 OracleServiceORACLE10
echo %1 DONE
goto end
:yesMan
echo ------- %1 tnslsnr--------
net %1 OracleOraDb10g_home1TNSListener
echo ======= %1 service=========
net %1 OracleServiceORACLE10
echo %1 DONE
goto end
:noo
echo NO action! please enter start/stop as paramter!
goto end
:end
echo end the bat!