BAT批处理学习

在日常电脑使用中,需要提高自动化能力,批处理(BAT)文件能很好的解决我们手动工作。

for: for /L %%a in (0,1,255) do ping 192.168.0.%%a -n 1 >> tmp.txt (ping一下所有的局域网电脑)

注意a只能是一个字母

1.计算器小例子:

@echo off
@echo *********** 计算器 ************
:menu
set /p var1=请输入第一个数字:
set /p var2=请输入第二个数字:
@echo 请选择:
@echo 1、+
@echo 2、-
@echo 3、*
@echo 4、/
set /p var3=输入选择运算符:
if /i "%var3%"=="1" goto opp1
if /i "%var3%"=="2" goto opp2
if /i "%var3%"=="3" goto opp3
if /i "%var3%"=="4" goto opp4
echo.
:opp1
set /a result=%var1% + %var2%
echo %var1% + %var2% = %result%
goto menu
echo.
:opp2
set /a result=%var1% - %var2%
echo %var1% - %var2% = %result%
goto menu
echo.
:opp3
set /a result=%var1% * %var2%
echo %var1% * %var2% = %result%
goto menu
echo.
:opp4
set /a result=%var1% / %var2%
echo %var1% / %var2% = %result%
goto menu
pause

2.flash做版

@echo off
echo "调转到工具目录......"
cd D:\work\source
D:
cd webControl_Data
echo "-----------------------------------------------------------------------"
echo "抽取和加密swc......"
PatchMaker.exe 2 "D:\work\client2" 0 "D:\work\destswc"

echo.
echo "-----------------------------------------------------------------------"
echo "复制文件......oclient"
xcopy D:\work\destswc\*.txt d:\work\WWW\resource\oclient /y
echo "-----------------------------------------------------------------------"
echo.
echo "-----------------------------------------------------------------------"
echo "复制文件......flash"
xcopy D:\work\client1\bxghWebStarterNew\bin-release\bxghWebStarterNew.swf D:\work\WWW\flash\BxghStarter.swf /y
xcopy D:\work\client1\bxghWebStarterNew\bin-release\bxghWebStarterNew.swf D:\work\WWW\flash\bxghWebStarter.swf /y
echo "-----------------------------------------------------------------------"
echo.
echo "-----------------------------------------------------------------------"
echo "打包languageList"
xcopy D:\work\client2\bxghStarterNew\src\LanguageList.txt D:\work\WWW\resource\data\data\LanguageList.txt /y
cd D:\work\WWW\resource\data
PatchData.bat
echo "打包完成"
echo "-----------------------------------------------------------------------"
echo.
pause


你可能感兴趣的:(Flash,Flash,bat,bat,bat)