Start In folder doesn't

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Windows LiveUser30 Windows LiveUser30 3 years, 7 months ago.

  • Author
    Posts
  • #11115
    Profile photo of Windows LiveUser30
    Windows LiveUser30
    Participant

    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.

  • #11116
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    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"
  • #11117
    Profile photo of Windows LiveUser30
    Windows LiveUser30
    Participant

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

You must be logged in to reply to this topic.