Why for loop wmic get processid return an extra invalid value?
Posted: 21 Dec 2023 03:30
Hi
Why for loop wmic get processid return an extra invalid value?
The first returned value %%a is the real processid
The second returned value %%a is a non-existent processid
Why??????????????
Please help
Why for loop wmic get processid return an extra invalid value?
Code: Select all
for /f "usebackq skip=1 delims=" %%a in (`wmic process where "name='cmd.exe' and commandline like '%%%~n0%%'" get processid 2^>nul`) do echo %%a
The second returned value %%a is a non-existent processid
Why??????????????
Please help