Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have created a powershell script I would like run at shutdown, and when I add it using gpedit.msc it executes exactly the way I would like.

However, I want to move it from C:\xyz.ps1 to C:\Program Files\abc\xyz.ps1, and when I do so it silently fails - what am I doing wrong?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

The 'browse' button in the 'Add a Script' dialog from the "Startup Properties" or "Shutdown Properties" dialog invoked from gpedit.msc allows you to browse to paths containing spaces, but if you do so, you need to manually enclose the path in quotes after browsing.

This doesn't seem very intuitive to me so I'm posting it here in case it saves someone else the trouble of finding out the hard way.

share|improve this answer
    
Admittedly, it would be nice if the GUI did it for you, but quoting spaces in a path is a pretty universal practice. –  EBGreen Aug 13 '12 at 13:01
1  
of course - on the command line, or in a script, but here it is highly unexpected to have to do it manually I think - can you think of any other single place you have to do it? You don't have to do it from within the "Run" box invoked with WINDOWS+R for example. –  Jack Douglas Aug 13 '12 at 13:25
    
Yes, because the GUI does the quoting. –  EBGreen Aug 13 '12 at 13:28
    
You have to do it in SCCM for instance. –  EBGreen Aug 13 '12 at 13:29
3  
Pretty sure that GPEdit.msc would be using the Microsoft Management Console. This is an old piece of software and actually doesn't have a whole lot of functionality in and of itself. It basically just hosts plugins. So it is very reliant on the plugins doing nice things. The GPEdit.msc plugin has also been around for quite some time and should probably been updated a long time ago to provide nice bells and whistles like quoting paths with strings. –  EBGreen Aug 13 '12 at 13:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.