Windows batch script to list files in directory and assign to variables -



Windows batch script to list files in directory and assign to variables -

i have scripted in unix, have requirement in windows. requirement property file contains path variable. script needs list files under path , phone call function on each file. have been trying

@for /f "tokens=1* delims==" %%a in (c:\work\sample\myfile.properties) ( if "%%a"=="mpwr_export_path" set mpwr_export_path=%%b if "%%a"=="file_share" set file_share=%%b ) cd %mpwr_export_path% %%i in (*) echo %%i

question is: how assign %%i variable , pass filename function dispay()

you don't need assign variable pass function. called function receives parameter %1 , can refined %~1 syntax.

i suggest alter cd command pushd. way (1) %mpwr_path% variable can contain drive letter or network path, , (2) bat can later cleanly restore current directory popd.

so, read help pushd , help call , seek this.

pushd %mpwr_path% %%i in (*) phone call :display %%i popd goto :eof :display echo %~f1 goto :eof

windows batch-file

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -