Author Posts

October 30, 2013 at 5:30 am

I've just received Mr. Jones' book "Learn Windows Powershell in a Month of Lunches" and am working my way through it. This is something I've never seen before. I create a Win 7 Pro desktop shortcut for PS v2 and configure the "Start in:" folder to be C:\SCRIPTS. I launch PS and I'm in the SCRIPTS folder, just as I should be. I close PS, bring up the Properties of the shortcut, select Advanced, and check "Run as administrator." When I launch PS via the shortcut again, the default folder is the C:\Windows\System32\ folder. Disabling the shortcut's "Run as administrator" switches back to the c:\SCRIPTS\ folder at the PS launch. I've deleted and recreated the shortcut a number of times and the behavior is the same.
If I can't use the shortcut's "Start in:" value, how do I make PS open the folder I want?
But I'm really more curious about why the "Running as administrator" always defaults to the c:\Windows\System32\ folder. I'm an administrator on the computer and the domain that the PC's joined to.

October 30, 2013 at 6:09 am

I'm not sure why it does that, but you can work around it by setting the directory as a command when launching Powershell, instead of relying on the "Start In" property of the shortcut. In the Target property of the shortcut, try doing something like this:

%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -NoExit -Command Set-Location "C:\Whatever"

October 30, 2013 at 6:17 am

Thanks Dave! I'm still struggling with the start-up switches so you've just saved me a whole lot of time.