|I'm having problems trying to extract drive letters from an anonymous system. Actually, I'm having a problem trying to trim down the results.|
This works well to collect the data:
wmic logicaldisk where drivetype=3 get deviceid >> %STORED%\DRIVES.TXT
:: IF NOT EXIST .\RESULTS MKDIR .\RESULTS
:: SET STORED=.\RESULTS
Typing the drives right before the for loop is correct, but one more step kills cmd.exe
When I try to use another for /f loop to skip the header, it crashes. The last thing that I tried was to add more variables to the final echo, but I'm completely in the dark as to why I did it, or even if it should be the case. Skip 2 is for the header and the Solid State C drive.
for /f "skip=2" %%x in (%STORED%\DRIVES.TXT) do echo %%g %%h %%i %%j %%k %%l %%m >> %STORED%\NEWDRIVES.TXT)
Does anybody with more experience see a blatant error on my part, and if you would be so kind, please rub my nose in it.
Finally, if I sometimes wish to skip 1, or skip 2, will the for /f loop accept the variable skip=%skip1%? I thought that might have been part of my problem, so I eliminated it, but it still crashes.
message edited by Longhand