We do face difficulties for running a Power Shell script and its not just like VB script,Batch script(just double click,it will run). here is the easy way to run a power shell script using single click.
Steps to do:
Open Notepad and Create a batch script with below lines.
@ECHO OFF
PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%~dpn0.ps1'"
Now save the Batch file with the same name of PowerShell script.
Right click on batch file and click on "Run as Administrator".
PowerShell script will get executed successfully.
Note: Both scripts need to be in the same directory to get it worked.
Steps to do:
Open Notepad and Create a batch script with below lines.
@ECHO OFF
PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%~dpn0.ps1'"
Now save the Batch file with the same name of PowerShell script.
Right click on batch file and click on "Run as Administrator".
PowerShell script will get executed successfully.
Note: Both scripts need to be in the same directory to get it worked.
No comments:
Post a Comment