How to... In Powershell

davidoffdavidoff Member Posts: 42 ■■□□□□□□□□
Hi, I have a basic question for Powershell, When I open my Powershell the default is C:\Users\Administrator> , I want to change this one to C:/Windows/system32 > , because i cannot follow the tutorial if it is in C:\Users\Administrator>,

Thank you and God Bless

Comments

  • ShdwmageShdwmage Member Posts: 374
    Right click -> run as administrator
    --
    “Hey! Listen!” ~ Navi
    2013: [x] MCTS 70-680
    2014: [x] 22-801 [x] 22-802 [x] CIW Web Foundation Associate
    2015 Goals: [] 70-410
  • cyberguyprcyberguypr Mod Posts: 6,928 Mod
    That doesn't change the working directory. You can change it by:

    - typing cd c:/windows/system32
    - typing Set-Location -Path C:\Windows\system32
  • pandiculatorpandiculator Member Posts: 44 ■■■□□□□□□□
    cyberguypr has provided the correct commands. However, you may not want to type this every time you open your console.

    PowerShell has a number of profile locations where you can store a profile script that will run each time you or, depending where you save it, anybody opens the console or the ISE.

    To create a profile that works just for you and only in the console:
    • Open your Documents folder
    • Create a folder called WindowsPowerShell (no spaces)
    • In the folder create a file called profile.ps1
    • Edit the file with the Notepad (no need to get fancy at this stage)
    • Type set-location 'C:\Windows\System32'
    • Save the file
    To get the profile to load you may need to change your ExecutionPolicy.
    Right-click on PowerShell and select Run as Administrator
    Run the command Set-ExecutionPolicy RemoteSigned

    Close and re-open PowerShell and you'll be in the working directory that you set.

    If you want to better understand the commands you're running use PowerShell's in-built help

    help about_profiles
    help set-location
    help Set-ExecutionPolicy
  • ShdwmageShdwmage Member Posts: 374
    Cyber, you are correct, that doesn't change the working directory. However, he will have issues in the future if he doesn't do what I listed, especially if UAC is still on.

    These tutorials want you to run powershell as an administrator. Powershell as admin automatically drops you into C:\windows\system32

    Thanks!

    --
    “Hey! Listen!” ~ Navi
    2013: [x] MCTS 70-680
    2014: [x] 22-801 [x] 22-802 [x] CIW Web Foundation Associate
    2015 Goals: [] 70-410
  • cyberguyprcyberguypr Mod Posts: 6,928 Mod
    I must have changed my profile. All my systems keep me in the user directory even as admin.
Sign In or Register to comment.