I have this wmic command which finds out the PID of my process and works fine from cmd, but refuses to produce output when executed in a bat-file:
wmic /output:process.pid process where (Name like '%java%' and commandLine like '%part-of-the-path%') get ProcessId
When I run it from cmd, it produces a file containing
The info is followed by two blank lines. When I run it from a batch-file, it only produces a file with two blank lines.
> filename and
| more > filename, all with the same result.
Why is this? How to make the command produce output from the batch?