Skip to content

Instantly share code, notes, and snippets.

@authentical
Last active March 18, 2020 23:16
Show Gist options
  • Save authentical/8f6ec19d12c22f1658e360b77cba5838 to your computer and use it in GitHub Desktop.
Save authentical/8f6ec19d12c22f1658e360b77cba5838 to your computer and use it in GitHub Desktop.
Restarts explorer
#brb
$rerun = 1
while($rerun -eq 1){
try{
if(![string]::IsNullOrEmpty(($explorerProc = Get-Process explorer))){
kill $explorerProc
try{
if(![string]::IsNullOrEmpty(($explorerProc = Get-Process explorer))){
echo ""
echo "Found explorer: $explorerProc"
echo ""
}
}
catch {
"explorer is not running."
explorer
}
}
}
catch {
"explorer is not running according to Get-Process explorer"
}
try{
if(![string]::IsNullOrEmpty(($explorerProc = Get-Process explorer))){
echo ""
echo "Found explorer: $explorerProc"
echo ""
}
}
catch {
"explorer is not running."
explorer
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment