New
#1
Cannot find matching string in text file with for /f
This line is part of an 11,000 line script. It fails to load the matching text from the file
This one works;Code:for /F "Usebackq Tokens=1* delims=," %%a in ("%SrcPath%\folders.txt") do IF /I "%%a"=="%USERNAME%" set GamePath=%%b
The delimiter is not the issue as I've tried both , and =.Code:for /F "Usebackq Tokens=1* delims==" %%a in ("%SRC%\PostInstall\%tFile%") do IF /I "%%a"=="%USERNAME%" set uWord=%%b
I have literally hundreds of these and they all work;
For the life of me I can't see why the first one won't work but hundreds of others do.Code:for /F "Usebackq Tokens=1* delims=," %%a in ("%SrcPath%\folders.txt") do IF /I "%%a"=="Hoyle Card Games" set GamePath=%%b for /F "Usebackq Tokens=1* delims=," %%a in ("%SrcPath%\folders.txt") do IF /I "%%a"=="Hearthstone" set GamePath=%%b
I thought it might be because I was comparing two variables, but as I show above, the one setting uWord works.
The line being searched for exists in folders.txt and the user name is spelled correctly.
It's the last lineCode:Among us,D:\STEAM\steamapps\common\Among Us Barotrauma,D:\STEAM\steamapps\common\Barotrauma BloonsTD6,D:\STEAM\steamapps\common\BloonsTD6 Cinderella Phenomonen,D:\STEAM\steamapps\common\Cinderella Phenomenon - OtomeVisual Novel Divinity Original Sin 2,D:\STEAM\steamapps\common\Divinity Original Sin 2 FINAL FANTASY XIV ONLINE,D:\GAMES\FF14 2\SquareEnix Hakuoki Edo Blossoms,D:\STEAM\steamapps\common\Hakuoki Edo Blossoms Hakuoki Kyoto Winds,D:\STEAM\steamapps\common\Hakuoki Kyoto Winds Nightshade,D:\STEAM\steamapps\common\Nightshade Origin, C:\Program Files (x86)\Origin SpeedRunners,D:\STEAM\steamapps\common\SpeedRunners Stardew Valley,D:\STEAM\steamapps\common\Stardew Valley The Sims 4,D:\Program Files (x86)\Origin Games\The Sims 4 The Sims 4 Snowy Escape,D:\Program Files (x86)\Origin Games\The Sims 4 Ubisoft,C:\Program Files (x86)\Ubisoft\Ubisoft Game Launcher CMTools,D:\CMTools FFBard,D:\FFBardMusicPlayer_1.4 Nexus,C:\Program Files\NMM Gabrielle,XXXXX-XXXXX-XXXXX-XXXXX
Anyone see what's wrong with the first for command above?
%srcpath% = I:\PostInstall\Gabrielle
I don't believe this is a delayedexpansion issue as this line is not within and IF (..) block.
It works fine from a command line (substituting %% for % of course).