I\'m trying to get the output of wmic process call create
so I can get the ProcessId
of the newly created process. If I just run:
w
I just found how can it be done. Due to the command was working only directly in the command prompt I decided to use cmd /c "..."
, it's as follows:
for /f "usebackq delims==; tokens=1,2" %i in (`cmd /c "wmic process call create 'notepad.exe a.txt','d:\'"^|findstr ProcessId`) do @echo pid = %j
Now the only thing is that the PID
needs to be trimed out of spaces, but that something else. Sorry for the inconvinience.