cmd变量,参数,for循环,
@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傳參問(wèn)題
::?? #linux sys
::?? #!/bin/sh
::?? 在linux系統(tǒng)中像如上指定$1要求傳參,但是當(dāng)在執(zhí)行時(shí)不加參時(shí)linux-shell事不會(huì)報(bào)錯(cuò)及提示的,但是我們可以用腳本實(shí)現(xiàn)簡(jiǎn)單的使用提示及幫助
::?? if [[ $# -eq 1 ]];
::???? echo "usage: sh $0 filename"
::?? fi
::?? file $1??? #查看由$1傳入的文件名及目錄等的參數(shù),
::
::?? ::windows sys
::?? @echo off
::?? type %1
::?? if "%1"=="a" format a:
::?? if exist g:\monitor\monitors\bat\cmd.bat type
::?? bat和shell有太多的偶然性相似,bat程序運(yùn)行結(jié)束會(huì)返回一個(gè)數(shù)值表示運(yùn)行程序的運(yùn)行結(jié)果,
pause
echo "Next see you,bye!"
pause
轉(zhuǎn)載于:https://www.cnblogs.com/ruiy/p/cmd.html
總結(jié)
以上是生活随笔為你收集整理的cmd变量,参数,for循环,的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Command_Of_Windows1
- 下一篇: 如何挑选基金经理 注意这几点就可以