How can I run this PowerShell script in a batch file? [duplicate]

How can I run this PowerShell script in a batch file?

(netsh wlan show profiles) | Select-String "\:(.+)$" |
%{$name=$_.Matches.Groups[1].Value.Trim(); $_} |
%{(netsh wlan show profile name="$name" key=clear)}  |
Select-String "Key Content\W+\:(.+)$" |
%{$pass=$_.Matches.Groups[1].Value.Trim(); $_} |
%{[PSCustomObject]@{ PROFILE_NAME=$name;PASSWORD=$pass }} |
Format-Table -AutoSize >> "Wifi.txt"

I found some solutions, but I couldn't find a regular way, so I couldn't solve this problem.

I want to run all PowerShell lines in one line in a batch file, like powershell.exe -command....., but I don't know how to put the sentence like this.



Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)