Calling a powershell function using a .bat file

Question:

I would like to know how to call a powershell function using a .Bat file.

I have this simple function:

(Script.ps1)

and I would like to call the function testfunction within the .Bat File.

powershell .\Script.ps1 …

Answer:

I noticed that there is a switch -ExecutionPolicy ByPass which allows the batch file to run using Powershell. This works here, taken from the answer by vonPryz.

Source:

Calling a powershell function using a .bat file by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply