Code: Select all
@ECHO OFF
for /f "tokens=*" %%a in (%tmp%\ExePath1.txt) do (
Call :MySplitPath %%a
)
echo.
echo This is the End of code.
pause
:MySplitPath %1
set val1=%*
for /f "tokens=2,3 delims=\" %%a in ("%val1%") do (
if NOT "%%b"=="WinSxS" echo %val1% >> %tmp%\SplitPath.txt
)
exit /b
I have a little script that need help with. Problem, every time my MySplitPath function is called, once it reads a line which consists of:
" C:\Program Files (x86)\NVIDIA Corporation\3D Vision\nvSCPAPISvr.exe "
my script errors out. Once the function tries to tokenize / read a line that has the " C:\Program Files (x86)\ " the error message I get is:
" \NVIDIA was unexpected at this time. "
How do you continue reading the %tmp%\SplitPath.txt file and correctly read / preserve the text line that has " C:\Program Files (x86)\ " ?
I am trying to parse out all the lines that have the associated "C:\Windows\WinSxS\" folder path and echo the remaining file content into %tmp%\SplitPath.txt
There's a text file that resides in %tmp%\ExePath1.txt. The contents of the ExePath1.txt is below.
An example of %tmp%\SplitPath.txt contents is also below too for illustration purposes.
very respectfully, Booga73
Contents of ExePath1.txt:
C:\Windows\System32\smss.exe
C:\Windows\WinSxS\amd64_microsoft-windows-smss-minwin_31bf3856ad364e35_6.3.9600.16384_none_6f1f364dbcc273d3\smss.exe
C:\Windows\WinSxS\amd64_microsoft-windows-smss-minwin_31bf3856ad364e35_6.3.9600.17031_none_6f522891bc9cbe45\smss.exe
C:\Windows\System32\csrss.exe
C:\Windows\WinSxS\amd64_microsoft-windows-csrss_31bf3856ad364e35_6.3.9600.16384_none_49a243e2b80cb4c0\csrss.exe
C:\Windows\System32\wininit.exe
C:\Windows\WinSxS\amd64_microsoft-windows-wininit_31bf3856ad364e35_6.3.9600.16384_none_21b118d9d847ad16\wininit.exe
C:\Windows\System32\services.exe
C:\Windows\WinSxS\amd64_microsoft-windows-s..cecontroller-minwin_31bf3856ad364e35_6.3.9600.16384_none_2fd72579d09a45e9\services.exe
C:\Windows\System32\lsass.exe
C:\Windows\WinSxS\amd64_microsoft-windows-lsa-minwin_31bf3856ad364e35_6.3.9600.16408_none_2e8484166600f08e\lsass.exe
C:\Program Files\NVIDIA Corporation\Installer2\Display.ControlPanel.{31C66714-96D3-430F-92A3-999C97F78393}\nvvsvc.exe
C:\Windows\System32\nvvsvc.exe
C:\Program Files (x86)\NVIDIA Corporation\3D Vision\nvSCPAPISvr.exe
C:\Windows\System32\spoolsv.exe
C:\Windows\WinSxS\amd64_microsoft-windows-printing-spooler-core_31bf3856ad364e35_6.3.9600.16384_none_c70a032c957fcb8a\spoolsv.exe
C:\Program Files (x86)\Common Files\Adobe\ARM\1.0\armsvc.exe
C:\Program Files (x86)\Common Files\Java\Java Update\jusched.exe
C:\Program Files (x86)\Common Files\Adobe\ARM\1.0\AdobeARM.exe
Contents of %tmp%\SplitPath.txt:
C:\Windows\System32\smss.exe
C:\Windows\System32\csrss.exe
C:\Windows\System32\wininit.exe
C:\Windows\System32\services.exe
C:\Windows\System32\lsass.exe
C:\Program Files\NVIDIA Corporation\Installer2\Display.ControlPanel.{31C66714-96D3-430F-92A3-999C97F78393}\nvvsvc.exe
C:\Windows\System32\nvvsvc.exe
C:\Windows\System32\smss.exe
C:\Windows\System32\csrss.exe
C:\Windows\System32\wininit.exe
C:\Windows\System32\services.exe
C:\Windows\System32\lsass.exe
C:\Program Files\NVIDIA Corporation\Installer2\Display.ControlPanel.{31C66714-96D3-430F-92A3-999C97F78393}\nvvsvc.exe
C:\Windows\System32\nvvsvc.exe