|
- @echo off
- ::要运行程序的绝对路径
- set program=C:\test.exe
- ::配置文件的搜索路径, 注意不必加上盘符
- set path=:\123\test.ini
- ::要搜索的盘符列表, 空格隔开
- set list=A B C D E F G H I J K L M N O P Q R S T U V W S Y Z
- :: 搜索到的配置文件路径 (程序自动设置)
- set target=
- for %%j in (%list%) do (
- if exist "%%j%path%" (
- set target=%%j%path%
- )
- )
- if "%target%"=="" (
- start "" "%program%"
- ) else (
- start "" "%program%" "%target%"
- )
- goto :eof
复制代码 |
|