[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文件操作] [已解决]怎样整理批处理中的路径?

请大家先在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后面直接修改了  这样看着就不乱了。。。。。也不知道大家听懂我的意思没
  1. @echo off
  2. :menu
  3. set /p chioce=请选择窗口开启数量(3~6):
  4. if /i "%chioce%"=="3" goto 3
  5. if /i "%chioce%"=="4" goto 4
  6. if /i "%chioce%"=="5" goto 5
  7. if /i "%chioce%"=="6" goto 6
  8. if /i "%choice%"=="%space%" echo. & echo 输入错误! 正在自动退出 & echo. & ping -n 2 127.1>nul & cls & goto start
  9. :3
  10. for /l %%i in (2,-1,0) do (
  11. cls
  12. echo 倒计时数%%i后启动程序
  13. ping 127.1 -n 2 >nul
  14. )
  15. start "" "D:\1.txt"
  16. for /l %%i in (2,-1,0) do (
  17. cls
  18. echo 倒计时数%%i后启动程序
  19. ping 127.1 -n 2 >nul
  20. )
  21. start "" "D:\1.txt"
  22. for /l %%i in (2,-1,0) do (
  23. cls
  24. echo 倒计时数%%i后启动程序
  25. ping 127.1 -n 2 >nul
  26. )
  27. start "" "D:\2.txt"
  28. start "" "C:\Documents and Settings\Administrator\Application Data\Microsoft\Internet Explorer\Quick Launch\显示桌面.scf"
  29. exit
  30. :4
  31. for /l %%i in (2,-1,0) do (
  32. cls
  33. echo 倒计时数%%i后启动程序
  34. ping 127.1 -n 2 >nul
  35. )
  36. start "" "D:\1.txt"
  37. for /l %%i in (2,-1,0) do (
  38. cls
  39. echo 倒计时数%%i后启动程序
  40. ping 127.1 -n 2 >nul
  41. )
  42. start "" "D:\2.txt"
  43. for /l %%i in (2,-1,0) do (
  44. cls
  45. echo 倒计时数%%i后启动程序
  46. ping 127.1 -n 2 >nul
  47. )
  48. start "" "D:\1.txt"
  49. for /l %%i in (2,-1,0) do (
  50. cls
  51. echo 倒计时数%%i后启动程序
  52. ping 127.1 -n 2 >nul
  53. )
  54. start "" "D:\1.txt"
  55. start "" "C:\Documents and Settings\Administrator\Application Data\Microsoft\Internet Explorer\Quick Launch\显示桌面.scf"
  56. exit
  57. :5
  58. for /l %%i in (2,-1,0) do (
  59. cls
  60. echo 倒计时数%%i后启动程序
  61. ping 127.1 -n 2 >nul
  62. )
  63. start "" "D:\2.txt"
  64. for /l %%i in (2,-1,0) do (
  65. cls
  66. echo 倒计时数%%i后启动程序
  67. ping 127.1 -n 2 >nul
  68. )
  69. start "" "D:\1.txt"
  70. for /l %%i in (2,-1,0) do (
  71. cls
  72. echo 倒计时数%%i后启动程序
  73. ping 127.1 -n 2 >nul
  74. )
  75. start "" "D:\1.txt"
  76. for /l %%i in (2,-1,0) do (
  77. cls
  78. echo 倒计时数%%i后启动程序
  79. ping 127.1 -n 2 >nul
  80. )
  81. start "" "D:\1.txt"
  82. for /l %%i in (2,-1,0) do (
  83. cls
  84. echo 倒计时数%%i后启动程序
  85. ping 127.1 -n 2 >nul
  86. )
  87. start "" "D:\2.txt"
  88. start "" "C:\Documents and Settings\Administrator\Application Data\Microsoft\Internet Explorer\Quick Launch\显示桌面.scf"
  89. exit
  90. :6
  91. for /l %%i in (2,-1,0) do (
  92. cls
  93. echo 倒计时数%%i后启动程序
  94. ping 127.1 -n 2 >nul
  95. )
  96. start "" "D:\1.txt"
  97. for /l %%i in (2,-1,0) do (
  98. cls
  99. echo 倒计时数%%i后启动程序
  100. ping 127.1 -n 2 >nul
  101. )
  102. start "" "D:\1.txt"
  103. for /l %%i in (2,-1,0) do (
  104. cls
  105. echo 倒计时数%%i后启动程序
  106. ping 127.1 -n 2 >nul
  107. )
  108. start "" "D:\1.txt"
  109. for /l %%i in (2,-1,0) do (
  110. cls
  111. echo 倒计时数%%i后启动程序
  112. ping 127.1 -n 2 >nul
  113. )
  114. start "" "D:\1.txt"
  115. for /l %%i in (2,-1,0) do (
  116. cls
  117. echo 倒计时数%%i后启动程序
  118. ping 127.1 -n 2 >nul
  119. )
  120. start "" "D:\1.txt"
  121. for /l %%i in (2,-1,0) do (
  122. cls
  123. echo 倒计时数%%i后启动程序
  124. ping 127.1 -n 2 >nul
  125. )
  126. start "" "D:\1.txt"
  127. start "" "C:\Documents and Settings\Administrator\Application Data\Microsoft\Internet Explorer\Quick Launch\显示桌面.scf"
  128. exit
复制代码
1

评分人数

    • Batcher: 感谢给帖子标题标注[已解决]字样PB + 2

  1. @echo off&setlocal enabledelayedexpansion
  2. ::定义规则
  3. set "dir1=D:\1.txt"
  4. set "dir2=D:\2.txt"
  5. set "#3=112"
  6. set "#4=1211"
  7. set "#5=21112"
  8. set "#6=111111"
  9. :Han:开始
  10. set/p Han=请选择窗口开启数量(3~6):
  11. if "%Han%" geq "3" if "%Han%" leq "6" goto:Ye
  12. echo 输入错误,请重新输入
  13. goto:Han
  14. :Ye:解析
  15. set/a Gu=Han-1
  16. for /l %%a in (0,1,%Gu%) do for %%b in (!#%Han%:~%%a^,1!) do (
  17.         for /l %%c in (2,-1,0) do (
  18.                 cls
  19.                 echo 倒计时数%%c后启动程序
  20.                 ping 127.1 -n 2 >nul
  21.                 )
  22.         start "" "!dir%%b!"
  23.         )
  24. start "" "%APPDATA%\Microsoft\Internet Explorer\Quick Launch\显示桌面.scf"
复制代码

[ 本帖最后由 hanyeguxing 于 2010-12-21 15:09 编辑 ]
1

评分人数

寒夜孤星:在没有说明的情况下,本人所有代码均运行在 XP SP3 下 (有问题请发贴,QQ临时会话已关闭)

TOP

#6=111111 这个用的是二进制吗?

TOP

回复 3# 34205


    只是个索引,1 对应 dir1,2 对应 dir2,用来简化楼主的重复代码

TOP

返回列表