background
I will write an easy way to run a PowerShell script. This is a personal memo level, but it also relates to the execution of PowerShell on this page, so just in case... The PowerShell extension .ps1 often does not work with normal settings. This is caused by PowerShell's security policy, so you can run it by lowering the security policy settings. Why are standard features limited? However, I personally don't feel comfortable lowering the security settings, so I would like to use it without lowering the security settings. From the results, you can avoid lowering the security policy by calling the .ps1 file via the batch file below. (I don't think there's any point in security if it can be executed with a batch file, but it's not a bad countermeasure to go one step further, so let's just say it)
deliverables
Copy the code below to Notepad, etc., and save the file with a .bat extension.
@echo off
powershell -NoProfile -ExecutionPolicy Unrestricted "実行したい.ps1のパス"
I think it will work if you change the ``Path of .ps1 you want to execute'' section.
brief Summary
There are other ways to run PowerShell scripts, but I've introduced a method that I've personally been able to compromise on. I don't want to do such a roundabout thing! If you search for "powershell security policy change", you will find many similar articles.