For a better and faster use of the PowerShell terminal we can create various scripts.
With the default settings we have a big disadvantage:  we have to always change the path to our scripts.
To remove this problem, we can create a new profile.

How it’s done ?

  • check if a profile exists using this command: Test-Path $profile
  • If the results is False then:
    • paste the following command: New-Item -path $profile -type file –force
Now a new profile is created in this locationC:Documents and SettingsAlexandruMy DocumentsWindowsPowerShell 

  • now we will create a folder for our scripts in a desired location: D:Scripturi
  • go to C:Documents and SettingsAlexandruMy DocumentsWindowsPowerShell and witha  text editor program open the Microsoft.PowerShell_profile.ps1 file.
By default, that file is empty, but depending on our needs, we can customize that file.
For example:
  • I want to change the default launch path;
  • I want to change the size of the PowerShell window;
  • I want to change the buffer size;
  • etc.
# Change the title of the window
$Shell=$Host.UI.RawUI.WindowTitle=”Alexandru Dionisie”
Write-Host "Alexandru Dionisie -"
# Set a new launch path
Set-Location "D:Scripturi"
# Change other properties
$Shell = $Host.UI.RawUI
$size = $Shell.WindowSize
$Shell.WindowSize = $size
$size = $Shell.BufferSize
$Shell.BufferSize = $size


Save and close the profile file.
Now open PowerShell and observe the new changes.

Because we changed the default path in the profile file, now we don’t need to use the cd command anymore. 
All we have to do is either type the script name, either type . and press the Tab key to navigate between scripts. 

Back To Top