git remove all branches except master windows

C++
git branch | %{ $_.Trim() } | ?{ $_ -ne 'master' } | %{ git branch -D $_ }
Source

Also in C++: