View Single Post
Old 11-16-2006   #4 (permalink)
Lucvdv


 
 

Re: "Permission Denied" when invoking PowerShell

On Thu, 16 Nov 2006 06:57:02 -0800, robw <robw@discussions.microsoft.com>
wrote:

> Correction: the error message is actually "Access is denied."


It's because you're using "%SystemRoot%" instead of "C:\Windows" in the
command (I had the same thing, or I wouldn't know either

By default, the "(Default)" value of a registry key isn't a REG_EXPAND_SZ
type, it's a REG_SZ and regedit offers no way to make it anything else.



Just replace the %systemroot% manually, or if you really want to stick to
%SystemRoot% instead of using the 'hard' path, create a .reg file that sets
the value as a BINARY(2) type.

Something like this:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\PowerShell\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,\

25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,57,00,69,\

00,6e,00,64,00,6f,00,77,00,73,00,50,00,6f,00,77,00,65,00,72,00,53,00,68,00,\

65,00,6c,00,6c,00,5c,00,76,00,31,00,2e,00,30,00,5c,00,70,00,6f,00,77,00,65,\
00,72,00,73,00,68,00,65,00,6c,00,6c,00,2e,00,65,00,78,00,65,00,00,00


BTW1, if you put it in the HKCR\Folder key it will work on a drive's root
directory too, instead of just subdirectories.
And on a lot more places, with varying degrees of success.

BTW2, you don't need to include the -command switch to set your location.
The fact that the app is started with the selected folder as current
directory is enough.
My System SpecsSystem Spec