I'm trying to write a batch to print through devcon and process the files later.
Here's my code
:: Change working directory to devcon
CD /d C:\Program Files (x86)\Windows Kits\10\Tools\x64
:: List all devices
devcon findall =USB ^> findallUsb.txt
:: Process each line
FOR /f "tokens=*" %%i IN (findallUsb.txt) do @echo %%i
PAUSE
And here's my output
C:\WINDOWS\system32>CD /d C:\Program Files (x86)\Windows Kits\10\Tools\x64
C:\Program Files (x86)\Windows Kits\10\Tools\x64>devcon findall =USB > findallUsb.txt
No matching devices found.
C:\Program Files (x86)\Windows Kits\10\Tools\x64>FOR /F "tokens=*" %i IN (findallUsb.txt) do @echo %i
The system cannot find the file findallUsb.txt.
C:\Program Files (x86)\Windows Kits\10\Tools\x64>PAUSE
Press any key to continue . . .
It seems that something is going wrong with the caret escape and the greater than character, but I can't figure it out. I obviously run the batch on as admin. When I run from the command line the file is printed correctly. If I omit the print switch, the results are listed correctly.