Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them, it only takes a minute:

I'm trying t develop a batch file that closes all the user processes in Windows 8, by using Powershell.

I use the code: Taskkill /f /fi "USERNAME eq Dave"

But when i run the batch file, it does not work. I just want to close all apps in Windows 8, that is...help?

share|improve this question

1 Answer 1

I usually use WMI objects in these situations:

Get-WmiObject win32_process |?{$_.getowner().user -eq "Dave"} |%{$_.Terminate()}

I don't know what your context is, so note that this will kill all processes for that user, including the explorer (and PowerShell itself, if it is running as the same user)

Your question is actually not very clear. Are you looking to create a batch file or a PowerShell script?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.