How do I change the default path in powershell?

Hi
I am running Windows 8.1 and want to change the default path when i open up DOS and Powershell. How do I do that?
thanks
lz7cjcAsked:
Who is Participating?
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
For "DOS" you need to link to cmd.exe in %WinDir%\system32 (or just use %ComSpec%, which should point to the exe).
Sounds as if you called command.exe, which is for compatibility with very ancient stuff only.

Also note that the per-window settings are based on the initial window title. The default settings are not, and applied always if there is no per-window one.
0
 
Praveen Kumar BonalaProgrammer AnalystCommented:
Use "Set-location" command let. which is equal to cd command.
Ex:> Set-Location c:\scripts

> Set-Location HKCU:\Software\Microsoft\Windows

> Set-Location D:\
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
If you can use shortcuts to start each, set the working directory in the shortcut properties.
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
lz7cjcAuthor Commented:
thanks - they are pinned to my start menu and don't get an option to choose properties.

As for set-location, it sounds like I use that once the program is open. I would like it to open by default to e.g.  c:\users\user\document\mdefaultfolder - every time I open Dos or Powershell.

thanks
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Yes, you can only pin executables, no shortcuts. If you need that, sorry, you have to run the CD or set-location each time.
You should either use Toolbars in the task bar (and have the shortcuts set up as described above), or put those shortcuts onto desktop and/or your start menu.
0
 
lz7cjcAuthor Commented:
ok understood - toolbars in the taskbar? would that enable me to put shortcuts on taskbar? that sound like a good happy medium. How do i do that? I can see the option to create a toolbar but not sure how to get the two shortcuts i need on there
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
You have to create a folder first, and then provide the path to that folder in the New Toolbar dialog. Then create your shortcuts in the folder you created, or drag existing shortcuts to the toolbar.
0
 
lz7cjcAuthor Commented:
ok great
will try it now
0
 
lz7cjcAuthor Commented:
not as easy i had hoped! I have found where powershell is but not DOS - any ideas?

I have changed the properties to increase the font and window size, and when it launches it launches as intended but then shrinks to a tiny size. i then edited the properties in the window and the default settings but it still doesn't behave how i want.

Finally what is the syntax for the path? Does %% indicate a sub folder? I have tried using that but now it defaults to system32 not even users!

 Is this a new question or are you happy answering here?
0
 
lz7cjcAuthor Commented:
thanks but there is no command.exe in %WinDir%\system32\

For powershell

the path doesn't change on opening: I have entered:
%HOMEDRIVE%%HOMEPATH\DOCUMENT\CODING\WEBSITES_GO_HERE
as well as
%HOMEDRIVE%%HOMEPATH%%DOCUMENT%%CODING%%WEBSITES_GO_HERE
and
%HOMEDRIVE%%HOMEPATH/DOCUMENT/CODING/WEBSITES_GO_HERE
but it opens up windows\system32
0
 
lz7cjcAuthor Commented:
oh and can't use comspec since am told it is in use by Avast
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
thanks but there is no command.exe in %WinDir%\system32\
Of course not. I referred to cmd.exe.

Regarding the paths you tried, they are probably all invalid. The first one is missing a %. You should also try step by step - %HOMEDRIVE%%HOMEPATH% works, but is the same as the default dir.
The "Document" folder does not exist, it is "Documents"
0
 
lz7cjcAuthor Commented:
yes - so it is - sorry was half asleep
all sorted - thanks for your help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.