Force Windows PowerShell To Run Commands At Start

So if you use PowerShell as much as I do then you know that every time you open it there are a number of commands you want to run immediately. So day in and day out you are repeatedly typing a number of commands.

Today we are going to automate that process so you don’t have to type those anymore.

First: We are going to create a “Profile” for you PoweShell instance using the following command from the PoweShell window.

new-item -path $profile -itemtype file -force


Then open the file using this command:

notepad $profile


The file will open in notepad where you can add the commands you want to load at start. I’ve added the command, start-transcript , so you can have an example. The next time I open PowerShell this command will run automatically.


Some Things to keep in mind:

If you create a profile in Notepad make sure to preserve the PS1 file name extension. Sometimes notepad will save your files with the extension .txt.

To load a profile, your Windows PowerShell execution policy must permit you to load configuration files. If it does not, the attempt to load the profile fails and Windows PowerShell displays an error message.

Categories: Computer StuffTags:

I want to hear what you have to say

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: