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


   运行时就一个黑框,不走了

TOP

回复 16# wlishihua


    那这样看行不行
  1. @echo off
  2. call :n 111.exe ddd.exe aaa.exe ............
  3. pause
  4. goto :eof
  5. :n
  6. set/a n+=1
  7. ipconfig|findstr /i "ipv4.*192\.168\.1\.%n%"&&start %1&&goto :eof
  8. shift
  9. if not "%n%"=="" goto :n
复制代码
1

评分人数

    • wlishihua: 没有什么不可能的,谢谢你技术 + 1

TOP

回复 17# idwma


    OK,但是只能启动exe,不能启动快捷方式

TOP

回复 18# wlishihua
写法不太好理解,就是说111.exe对应的是192.168.1.1  DDD.EXE 对应的就是192.168.1.2  依次类推,是吗?
查询从192.168.1.1开始,到192.168.1.255结束

TOP

本帖最后由 wlishihua 于 2021-8-14 20:50 编辑

回复 17# idwma


@echo off
cd /d %~dp0
for /f "delims=: tokens=1,2" %%a in ('ipconfig ^|find "IPv4"') do echo,%%b&set ips=%%b
if %ips% == 192.168.1.1start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
if %ips% == 192.168.1.2  start "" "C:\Users\Administrator\Desktop\MHTCGI\mhtcgi.exe"
if %ips% == 192.168.1.3  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"

exit
这个好理解,能启动lnk文件

比如说从192.168.2到192.168.100,只执行一个文件  192.168.101到192.168.253  又执行另外一个文件,你那个代码怎么办?

TOP

本帖最后由 wlishihua 于 2021-8-14 20:59 编辑

回复 17# idwma

@echo off
cd /d %~dp0
for /f "delims=: tokens=1,2" %%a in ('ipconfig ^|find "IPv4"') do echo,%%b&set ips=%%b
if %ips% == 192.168.1.1  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
if %ips% == 192.168.1.2  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
if %ips% == 192.168.1.3  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
if %ips% == 192.168.1.4  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"

if %ips% == 192.168.1.5  start "" "C:\Users\Administrator\Desktop\MHTCGI\mhtcgi.exe"
if %ips% == 192.168.1.6  start "" "C:\Users\Administrator\Desktop\MHTCGI\mhtcgi.exe"
if %ips% == 192.168.1.7  start "" "C:\Users\Administrator\Desktop\MHTCGI\mhtcgi.exe"
if %ips% == 192.168.1.8  start "" "C:\Users\Administrator\Desktop\MHTCGI\mhtcgi.exe"
.........
exit
::四个IP地址为一组

你那个代码怎么写
if %ips% == 192.168.1.1  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
if %ips% == 192.168.1.2  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
if %ips% == 192.168.1.3  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
if %ips% == 192.168.1.4  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
如果是253个IP,那么这个就要写253个IP地址,能不能简化一下

TOP

回复 5# yakeyun


    @echo off
cd /d %~dp0
for /f "delims=: tokens=1,2" %%a in ('ipconfig ^|find "IPv4"') do echo,%%b&set ips=%%b
if %ips% == 192.168.1.1  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
if %ips% == 192.168.1.2  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
if %ips% == 192.168.1.3  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
if %ips% == 192.168.1.4  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"

if %ips% == 192.168.1.5  start "" "C:\Users\Administrator\Desktop\MHTCGI\mhtcgi.exe"
if %ips% == 192.168.1.6  start "" "C:\Users\Administrator\Desktop\MHTCGI\mhtcgi.exe"
if %ips% == 192.168.1.7  start "" "C:\Users\Administrator\Desktop\MHTCGI\mhtcgi.exe"
if %ips% == 192.168.1.8  start "" "C:\Users\Administrator\Desktop\MHTCGI\mhtcgi.exe"
.........
exit
::四个IP地址为一组

代码怎么写
if %ips% == 192.168.1.1  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
if %ips% == 192.168.1.2  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
if %ips% == 192.168.1.3  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
if %ips% == 192.168.1.4  start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
如果是253个IP,那么这个就要写253个IP地址,能不能简化一下 用分组的方式

TOP

回复 21# wlishihua

改一下可以快捷方式
    好像也可以四个一跳,后面的多少一跳以此类推来改
这里的1到4,4到8,8到253
  1. @echo off
  2. call :n "C:\Users\Administrator\Desktop\Microsoft Edge.lnk" "C:\Users\Administrator\Desktop\MHTCGI\mhtcgi.exe" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
  3. pause
  4. goto :eof
  5. :n
  6. set/a n+=1
  7. ipconfig|findstr /i "ipv4.*192\.168\.1\.%n%"&&start "" "%~1"&&goto :eof
  8. if %n%==4 shift
  9. if %n%==8 shift
  10. if %n%==253 shift
  11. if not "%n%"=="" goto :n
复制代码
1

评分人数

TOP

回复 23# idwma


    OK  谢谢!

TOP

本帖最后由 wlishihua 于 2021-8-14 21:58 编辑

回复 23# idwma
还是这样我们以MAC地址来确定,


@ipconfig /all|FIND /I "4C-CC-6A-FC-D6-59">NUL 2>NUL&& start "" "C:\Users\Administrator\Desktop\MHTCGI\mhtcgi.exe"
@ipconfig /all|FIND /I "4C-CC-68-FC-D6-58">NUL 2>NUL&& start "" "C:\Users\Administrator\Desktop\MHTCGI\mhtcgi.exe"

@ipconfig /all|FIND /I "4C-CC-69-FC-D6-60">NUL 2>NUL&& start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"
@ipconfig /all|FIND /I "4C-CC-6A-FC-D6-61">NUL 2>NUL&& start "" "C:\Users\Administrator\Desktop\Microsoft Edge.lnk"

@ipconfig /all|FIND /I "4C-CC-65-FC-D6-66">NUL 2>NUL&& start "" "C:\Users\Administrator\Desktop\ddd.exe"
@ipconfig /all|FIND /I "4C-CC-6A-FC-D6-88">NUL 2>NUL&& start "" "C:\Users\Administrator\Desktop\ddd.exe"
这个怎么分组?
分不了组我就要写253个

TOP

回复 25# wlishihua

这个地址不连序
    如果先把这两百多个mac按顺序排列好,也可以操作一下

TOP

返回列表