I have a very simple script that I want to take a value from a text document (single line, one value) and pass it to taskkill - it needs to be a one liner too so I have:
set /p pidtokill=<C:\temp\pid.txt && taskkill /F /PID %pidtokill%
The issue is that the pidtokill variable is only updated AFTER the taskkill command has executed, e.g. if I run the command twice the taskkill works, but the first time round it will use the previous value stored in the variable... why isn't the pidtokill value set "in time" for the taskkill command?