[How To] Open all Ps1 files at once
Have you ever wondered how to open multiple or all the PowerShell Scripts at once? then read below.
Below is the script which opens all the .Ps1 files in PowerShell ISE once you execute it.
$fileDirectory = "./"
$parse_results = New-Object System.Collections.ArrayList;
foreach($file in Get-ChildItem $fileDirectory){PowerShell_ISE $file}
Save this as “
Right click on this file and select open with PowerShell. This will open all the script files in the directory in PowerShell ISE for editing.
In the same directory, Create a new file called “AllScripts.bat”(Name should be same as the
@ECHO OFF
PowerShell.exe -Command "& '%~dpn0.ps1'"
Whenever you want to open the scripts, just double click the AllScripts.bat.
Note:
For your knowledge, This batch file will open the
Microsoft has set Notepad as the default app for PowerShell Scripts for security reasons. Hence, we have to execute the files in the above-given method. Alternatively, you can set the PowerShell as the default app and execute it directly. But that is not a best practice for security reasons.
Definitely, what a splendid website and enlightening posts, I definitely will bookmark your blog.All the Best!