Need to know to club the power shell commands to one script

Hi All,
I am looking to club 5 commands to one power shell script, I know we can use semicolon as a separator but using execute policy in each command is not looking nice. Please suggest :-1:

powershell.exe -ExecutionPolicy Bypass -command set-NetAdapterAdvancedProperty W* -RegistryKeyword “RoamAggressiveness” -RegistryValue ‘4’
powershell.exe -ExecutionPolicy Bypass -command Set-NetAdapterAdvancedProperty W* -RegistryKeyword “RoamingPreferredBandType” -RegistryValue “2”
powershell.exe -ExecutionPolicy Bypass -command set-NetAdapterAdvancedProperty W* -RegistryKeyword “IEEE11nMode” -RegistryValue ‘2’
powershell.exe -ExecutionPolicy Bypass -command Set-NetAdapterAdvancedProperty W* -RegistryKeyword “IbssTxPower” -RegistryValue “100”
powershell.exe -ExecutionPolicy Bypass -command Set-NetAdapterAdvancedProperty W* -RegistryKeyword “802.11n/ac Wireless Mode” -RegistryValue “2”

Regards,
Vishal

Vishal,
Welcome to the forum. :wave:t4:

Why thumbs down? :thinking:

My suggestion would be to do a step back and start with learning the very basics of PowerShell first. What you’re asking for is topic of the very first chapter of almost any tutorial or book or course you could do.
For example this one here:

BTW: When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance

How to format code in PowerShell.org <---- Click :point_up_2:t4: :wink:

Regardless of that: The commandline argument -ExecutionPolicy Bypass is actually not needed to run individual single commands. It only applies to scripts.

1 Like