How to replace string inside a bat file with command line parameter string

后端 未结 3 526
醉梦人生
醉梦人生 2020-12-05 01:20

I have following in a cmd batch file:

for /f %%l in (%2) do (for %%f in (%%l) do copy \"%%f\" %1))

note : this script basically does is rea

3条回答
  •  独厮守ぢ
    2020-12-05 01:41

    If you need to substitute several parameters in one string, just use "for /f" to set variable with previous substitution like this:

    SET "output1=%1"
    CALL SET output1=%%output1:%3=%4%%
    for /f "tokens=1" %%a in ('echo %output1%') do set output2=%%a
    CALL SET output2=%%output2:%5%6%
    for /f "tokens=1" %%a in ('echo %output2') do set output3=%%a
    

提交回复
热议问题