批处理读取配置文件
2024-1-15 乱云飞
@echo offsetlocal enabledelayedexpansion
set "file=1.txt"
set "lineCount=0"
for /f "tokens=*" %%a in (%file%) do (
set /a lineCount+=1
if !lineCount!==1 set "param1=%%a"
if !lineCount!==2 set "param2=%%a"
if !lineCount!==3 set "param3=%%a"
)
echo Parameter 1: %param1%
echo Parameter 2: %param2%
echo Parameter 3: %param3%
cmd/k
===========================================
@echo off
::------------------------------------------
setlocal enabledelayedexpansion
set "line=0"
for /f "tokens=*" %%a in (1.txt) do (
set /a "line+=1"
if !line!==1 set "url=%%a"
)
::------------------------------------------
echo %url%
cmd/k
===========================================
@echo off
set /p url=<1.txt
for /f "skip=2 delims=" %%a in (1.txt) do set url=%%a&goto next
:next
echo %url%
cmd/k
发表评论: