Home
Certification Preparation
Microsoft
MCSA / MCSE on Windows 2012 General
How to... In Powershell
davidoff
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
Find more posts tagged with
Comments
Shdwmage
Right click -> run as administrator
cyberguypr
That doesn't change the working directory. You can change it by:
- typing cd
c:/windows/system32
- typing
Set-Location -Path C:\Windows\system32
pandiculator
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
Shdwmage
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!
powershell as admin.jpg
cyberguypr
I must have changed my profile. All my systems keep me in the user directory even as admin.
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Best Of