I’m trying to convert my old BAT script to PowerShell version,
but after one hour googling I have no idea how to do it.
I’m looking for a structure very similar to the old one, find open net files,
get its PID and close it.
BAT:
for /f "skip=4 tokens=1" %a in ('net files ^| findstr C:\Apps\') do net files %a /close
PowerShell?
Net file is still your best bet. Try something like this: