Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Note: This isn't really a Perl thing, but I'm using it for Perl scripts and it's too handy not to share.

I have a few scripts that I run frequently for work. Most parse the files in a directory and create an HTML report file. I wanted to share these with coworkers, but didn't want to have to explain the command prompt to them. My solution was going to be telling everyone to stick the .pl file in their local directory and then double-click it. (They already have Perl installed.) The problem is that we need to run these scripts in many, many directories and there are too many potential problems that can occur when you have multiple copies of the same script all over a hard drive.

I was thinking about a way to make this easier. The best idea I had was to allow them to right-click on a folder in Explorer and run the script from the context menu. I just had no idea how to do that. Thanks to Windows 98 Right Mouse Click Customisation, I was able to figure it out.

If you're interested in trying this, here are the steps.

Note: These instructions were written and tested using Windows 2000. They may be different for your version. Oh, and it's the registry, be careful in there. If you don't know the risks of editing registry keys, then don't do it.

  1. Open the Registry Editor by running regedit.
  2. Expand HKEY_CLASSES_ROOT > Directory.
  3. Right-click on shell under Directory and select New > Key.
  4. Enter a name for the script you're adding. I don't know if there are restrictions, but since this is not for display, don't use anything by letters and numbers (just to be safe).
  5. Left-click on the name you just entered. You'll see a (Default) value in the main window. Right-click on (Default) and select Modify.
  6. Enter the display name for your script in the Value data field. Click OK when you're done.
  7. Right-click on the name you entered in step 4 and select New > Key.
  8. Enter command.
  9. Click on the command folder. You'll see a (Default) value in the main window. Right-click on (Default) and select Modify.
  10. Enter the command line for your script in the Value data field. For example, perl.exe c:\work\perl\qaHelpTitles.pl. Click OK when you're done.
  11. Open an Explorer window and test by right-clicking on a folder and selecting the display name you entered.
  12. If everything worked, then close the Registry Editor. If there were problems, then you may want to verify that perl.exe is in your path or the path and filename for the script are correct. Try pasting the command line into a Command Prompt window and running it that way. If it works, then I'm not sure what went wrong here. Sorry.

Hope this helps!


In reply to (Not Quite Perl) Running Scripts from Right-Click Context Menu in Windows by svsingh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (2)
    As of 2014-08-31 01:43 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The best computer themed movie is:











      Results (294 votes), past polls