News:

The Latest electronic and computer Tips that work!

Main Menu

Run a PowerShell script from a batch file

Started by branx86, August 21, 2018, 02:56:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

branx86


You need the -ExecutionPolicy parameter:

Powershell.exe -executionpolicy remotesigned -File  C:\Users\SE\Desktop\ps.ps1

Otherwise PowerShell considers the arguments a line to execute and while Set-ExecutionPolicy is a cmdlet, it has no -File parameter.