0
我想使Windows(7)批處理腳本與參數中的變量,我不斷得到錯誤,是否有人知道如何解決這個問題?Windows批處理/ Windows cmd循環參數與變量
@ECHO OFF
:::: settings ::::
SET "InputFile=D:\somefile.ext"
SET "linesToSkipCharacter="
SET "endOfLineCharacter="
SET "RowNoToRead=1"
SET "delimiterCharacter=;"
::::::::::::::::::::::
:: make shore the variables are emty
SET "linesToSkip=" "endOfLine=" "tokens=" "delims="
:: if set put parameter into variable
if not "%delimiterCharacter%"=="" SET "delims=delims=%delimiterCharacter% "
if not "%linesToSkipCharacter%"=="" if not "%linesToSkipCharacter%"=="0" SET "linesToSkip=skip=%linesToSkipCharacter% "
if not "%endOfLineCharacter%"=="" if not "%endOfLineCharacter%"=="0" SET "endOfLine=eol=%endOfLineCharacter% "
if not "%RowNoToRead%"=="" if not "%RowNoToRead%"=="0" SET "tokens=tokens=%RowNoToRead%"
:: loop File with the given parameters
fOR /F "%delims%%linesToSkip%%endOfLine%%tokens%" %%A IN (%InputFile%) DO echo do something with %%A
你得到了什麼錯誤? – SomethingDark