|
Answer» Howdy,
I have a for loop that parse a txt file and replaces some lines if it matches a certain string. The problem is there is ONE line in the file that contains a coup "&" symbols. When the batch file runs the commend "set line=%~1" it basically errors out because it takes it as a special character rather than just text. I know normally you could escape this with a ^ but since this is a variable, not hard code, I'm not SURE what to do. Please find the script and problem line below. As always any help is appreciated.
Script: Code: [Select]for /F "delims=" %%a in (%TEMP%\lexw.ini) do call :process "%%a" goto :EOF
:process set line=%~1 set line2= if "%line%"=="[MENU]" set line2=DAY=Daily Operating Report System (DOR) echo %line% >> "%systemroot%\lexw.ini" if defined line2 echo %line2% >> "%systemroot%\lexw.ini" :EOF
Problem: Code: [Select]set line=MRU3=\\<removed>\CPM\MMM\SYSRPTS\<removed>\Z300 F&B\F&B Summary w EDR.lrf You do know that folder and files names containing the "poison character" & are STRONGLY deprecated in NT? That your IT people are, therefore, dorks?
This might help
Quote Handling "&" in a folder name
http://tinyurl.com/2qenvy
Quote from: contrex on SEPTEMBER 28, 2007, 01:23:54 PMThat your IT people are, therefore, dorks?
i believe you know who the bigger dorks are?Quote from: ghostdog74 on September 28, 2007, 08:06:35 PMi believe you know who the bigger dorks are? The people who post here asking us to do their jobs or school assignments for them, or us, for doing it?
|