标题: [文件操作] [已解决]怎样整理批处理中的路径? [打印本页]
作者: qq415650 时间: 2010-12-21 14:02 标题: [已解决]怎样整理批处理中的路径?
请大家先在D盘建立个1.txt 和2.txt 然后运行下下面的批处理
我想请高手帮我修改下
你也看到了 里面有N多的文件路径D:\1.txt 和 D:\2.txt 现在我要是想把它改成其他软件的路径 感觉太费劲了 有点眼花缭乱
我想请你把里面的 D:\1.txt 和 D:\2.txt 弄成一个编码 然后再批处理最下面显示出来。比如让D:\1.txt 等于“di1” D:\2.txt等于“di2” 然后再批处理最后面 注释di1等于什么 di2等于什么 ,然后我以后修改的时候就可以在最后面的 di1 di2后面直接修改了 这样看着就不乱了。。。。。也不知道大家听懂我的意思没- @echo off
- :menu
- set /p chioce=请选择窗口开启数量(3~6):
- if /i "%chioce%"=="3" goto 3
- if /i "%chioce%"=="4" goto 4
- if /i "%chioce%"=="5" goto 5
- if /i "%chioce%"=="6" goto 6
-
- if /i "%choice%"=="%space%" echo. & echo 输入错误! 正在自动退出 & echo. & ping -n 2 127.1>nul & cls & goto start
-
- :3
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\1.txt"
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\1.txt"
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\2.txt"
- start "" "C:\Documents and Settings\Administrator\Application Data\Microsoft\Internet Explorer\Quick Launch\显示桌面.scf"
- exit
-
- :4
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\1.txt"
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\2.txt"
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\1.txt"
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\1.txt"
- start "" "C:\Documents and Settings\Administrator\Application Data\Microsoft\Internet Explorer\Quick Launch\显示桌面.scf"
- exit
-
- :5
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\2.txt"
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\1.txt"
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\1.txt"
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\1.txt"
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\2.txt"
- start "" "C:\Documents and Settings\Administrator\Application Data\Microsoft\Internet Explorer\Quick Launch\显示桌面.scf"
- exit
-
- :6
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\1.txt"
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\1.txt"
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\1.txt"
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\1.txt"
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\1.txt"
- for /l %%i in (2,-1,0) do (
- cls
- echo 倒计时数%%i后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "D:\1.txt"
- start "" "C:\Documents and Settings\Administrator\Application Data\Microsoft\Internet Explorer\Quick Launch\显示桌面.scf"
- exit
复制代码
作者: hanyeguxing 时间: 2010-12-21 14:44
- @echo off&setlocal enabledelayedexpansion
- ::定义规则
- set "dir1=D:\1.txt"
- set "dir2=D:\2.txt"
- set "#3=112"
- set "#4=1211"
- set "#5=21112"
- set "#6=111111"
- :Han:开始
- set/p Han=请选择窗口开启数量(3~6):
- if "%Han%" geq "3" if "%Han%" leq "6" goto:Ye
- echo 输入错误,请重新输入
- goto:Han
- :Ye:解析
- set/a Gu=Han-1
- for /l %%a in (0,1,%Gu%) do for %%b in (!#%Han%:~%%a^,1!) do (
- for /l %%c in (2,-1,0) do (
- cls
- echo 倒计时数%%c后启动程序
- ping 127.1 -n 2 >nul
- )
- start "" "!dir%%b!"
- )
- start "" "%APPDATA%\Microsoft\Internet Explorer\Quick Launch\显示桌面.scf"
复制代码
[ 本帖最后由 hanyeguxing 于 2010-12-21 15:09 编辑 ]
作者: 34205 时间: 2015-1-23 15:58
#6=111111 这个用的是二进制吗?
作者: CrLf 时间: 2015-1-23 16:42
回复 3# 34205
只是个索引,1 对应 dir1,2 对应 dir2,用来简化楼主的重复代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |