Need help for executing vbscript in right click menu

Author Message
amitananddey

  • Total Posts : 2
  • Scores: 0
  • Reward points : 0
  • Joined: 12/19/2011
  • Status: offline
Need help for executing vbscript in right click menu Monday, December 19, 2011 5:46 PM (permalink)
0
[Helpful answer received] / [List Solutions Only]
Hi friends,
I have found a vbscript to make directory and edited it according to my purpose.
The problem is I want to run this script from the right click menu.
What I have found and searched in the web is that you need to add it to the registry.
But I dont know how to do it.
I have just started to know and learn about programming.
Please help me to learn more about it.
 
#1
    59cobalt

    • Total Posts : 977
    • Scores: 91
    • Reward points : 0
    • Joined: 7/17/2011
    • Status: offline
    Re:Need help for executing vbscript in right click menu Tuesday, December 20, 2011 7:21 AM (permalink)
    5
    [This post was marked as helpful]
    What you're asking about is not programming, but system administration.

    The HKEY_CLASSES_ROOT hive basically maps extensions to actions. It's actually more complicated than that, but for a basic understanding this simplification will suffice.

    Start Regedit and take a look at the key [HKCR\.txt]. You'll notice the string "txtfile" in the Default value. Now take a look at [HKCR\txtfile]. You have two subkeys there: DefaultIcon and shell. The shell subkey has several subkeys as well: open, print and printto. These are the actions Windows has registered for text files. The command subkey of either of these actions specifies the command that is executed when the action is invoked. In case of open that command is "%SystemRoot%\system32\NOTEPAD.EXE %1", i.e. "run Notepad and have it open the given file".
    The Windows Explorer shows these actions in the context menu of a file or folder. Change the Default value of an action to an arbitrary string, and that string will be displayed as the caption instead of the key name. The default action (the fat entry in the context menu) is open, but it can be changed by specifying a different action in the Default value of the shell key.

    Example:
    [HKEY_CLASSES_ROOT\txtfile\shell]
    @="print"
    
    [HKEY_CLASSES_ROOT\txtfile\shell\open]
    @="Open Sesame"
    This would change the default action for text files to print, and also change the caption of the open action to "Open Sesame".

    Now, what you need to do to add your script to the context menu is:
    • find a suitable file type
    • create a new action (e.g. createdir) under the shell key of that file type
    • create a command key under the action
    • specify the command, e.g. "wscript.exe C:\PATH\TO\your.vbs %1"
     
    HTH
     
    #2
      amitananddey

      • Total Posts : 2
      • Scores: 0
      • Reward points : 0
      • Joined: 12/19/2011
      • Status: offline
      Re:Need help for executing vbscript in right click menu Wednesday, December 21, 2011 10:36 PM (permalink)
      0
      Thanks [link=showprofile.aspx?memid=30096]59cobalt[/link] for examplaing such beautifully.Thanks a lot again.
       
      #3
        59cobalt

        • Total Posts : 977
        • Scores: 91
        • Reward points : 0
        • Joined: 7/17/2011
        • Status: offline
        Re:Need help for executing vbscript in right click menu Thursday, December 22, 2011 5:23 AM (permalink)
        0
        You're welcome.
         
        #4

          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.9