cmd变量,参数,for循环,

时间:2023-03-08 20:49:33

@echo off
rem  *****************************************************
rem  Create By Q_rui CopryRight@_   www.yoodo.com
rem  Mail:  rui.qin@yoodo.com
rem  Version V1.0 beat
rem  2013-08-*
rem  Blog:  cnblogs.com/rui
rem  *****************************************************

::【Scripts aim function area】
echo Current time:  %date%,%time%
echo Current directory:  %cd%
echo Local host system type:  %OS%
echo "Current running filename:" %0
echo "this bat scripts first paramenters:" %1
::echo "this is scripts run result:" %!
::for /f %%i in (./websites.txt) do G:\monitor\curl -I %%i
if "%0" == "cmd.bat" type %0

::【Comment area】
::G:\monitor\curl --connect-timeout 12 --max-time 10 -o > nul -s -w %{http_code} http://192.168.1.109
echo "" >>nul

::linux and windows shell,bat传参问题
::   #linux sys
::   #!/bin/sh
::   在linux系统中像如上指定$1要求传参,但是当在执行时不加参时linux-shell事不会报错及提示的,但是我们可以用脚本实现简单的使用提示及帮助
::   if [[ $# -eq 1 ]];
::     echo "usage: sh $0 filename"
::   fi
::   file $1    #查看由$1传入的文件名及目录等的参数,
::
::   ::windows sys
::   @echo off
::   type %1
::   if "%1"=="a" format a:
::   if exist g:\monitor\monitors\bat\cmd.bat type
::   bat和shell有太多的偶然性相似,bat程序运行结束会返回一个数值表示运行程序的运行结果,

pause
echo "Next see you,bye!"
pause