Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. System Admin
  4. Adding Runas to Folder Context Menu

Adding Runas to Folder Context Menu

Scheduled Pinned Locked Moved System Admin
tutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vimal_yet
    wrote on last edited by
    #1

    Hi All, can any one say me how to add "RunAs" to Folder Context Menu in windows XP... Just Like it works for Exe files. Thanks in Advance

    If U Get Errors U Will Learn If U Don't Get Errors U Have Learnt

    C 1 Reply Last reply
    0
    • V vimal_yet

      Hi All, can any one say me how to add "RunAs" to Folder Context Menu in windows XP... Just Like it works for Exe files. Thanks in Advance

      If U Get Errors U Will Learn If U Don't Get Errors U Have Learnt

      C Offline
      C Offline
      Craster
      wrote on last edited by
      #2

      You can't really 'run' a folder as such, so it won't work in quite the same way. I'd say you'd need to do one of two things: 1) Write a context menu shell extension in your language of choice. Google for "context menu shell extension" and there should be loads of help. 2) This is a cowboy approach. Create a vbscript to do the job for you. Put this in it: 'grab the username sUsername = InputBox("Enter Username") 'create a shell command object set oCmd = createobject("Wscript.Shell") 'Build the runas string passing the folder name to explorer.exe sCmd = "runas /u:" & sUsername & " " & chr(34) & "explorer " & wscript.arguments(0) & chr(34) 'Run the command oCmd.run sCmd Save it in your c:\documents and settings\%username%\sendto folder (show hidden files and folders to see this folder). Now when you right-click the folder, you should see your script under the 'Send To' context menu. If you select it, you'll get an inputbox prompt for the username, a dos prompt for the password, and it should open the folder using that user's credentials for you. It's a messy lash, but it works.

      V 1 Reply Last reply
      0
      • C Craster

        You can't really 'run' a folder as such, so it won't work in quite the same way. I'd say you'd need to do one of two things: 1) Write a context menu shell extension in your language of choice. Google for "context menu shell extension" and there should be loads of help. 2) This is a cowboy approach. Create a vbscript to do the job for you. Put this in it: 'grab the username sUsername = InputBox("Enter Username") 'create a shell command object set oCmd = createobject("Wscript.Shell") 'Build the runas string passing the folder name to explorer.exe sCmd = "runas /u:" & sUsername & " " & chr(34) & "explorer " & wscript.arguments(0) & chr(34) 'Run the command oCmd.run sCmd Save it in your c:\documents and settings\%username%\sendto folder (show hidden files and folders to see this folder). Now when you right-click the folder, you should see your script under the 'Send To' context menu. If you select it, you'll get an inputbox prompt for the username, a dos prompt for the password, and it should open the folder using that user's credentials for you. It's a messy lash, but it works.

        V Offline
        V Offline
        vimal_yet
        wrote on last edited by
        #3

        Thank you ... for your comments

        If U Get Errors U Will Learn If U Don't Get Errors U Have Learnt

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups