How do I change $pshome?

I’m a new user and prefer not to use my Documents folder. Can I change the value of $pshome to an arbitrary folder on my computer?

$pshome is the PowerShell installation folder. You can’t change that, no.

Aah, I see. So to use a different folder for data, I would have to set a new variable and use it explicitly to “cd” or “save to”?

So… maybe I don’t understand the situation.

PowerShell does not automatically save anything to $pshome. Most commands that save something, such as Out-File, simply default to the current directory, whatever that might be. You can always specify an alternate path, along with the filename, if you want something saved elsewhere.

I presume you’re using the ISE, because you mentioned “save to.” The ISE also defaults to saving to the current directory, whatever that is. It doesn’t default to $pshome. Setting a variable doesn’t change any of that behavior. If you want to save a script to C:\Script, just type "C:\Script" before the filename. Same as anywhere else in Windows.

The ISE may default to your Documents folder - like most other apps do - but you can specify any other directory.

Thanks again for your prompt and accurate reply. As I said, I am just learning PowerShell and must have misread something in Chapter 1. Yes your interpretation is correct and I get it now.