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. Shortcut to Command Prompt

Shortcut to Command Prompt

Scheduled Pinned Locked Moved System Admin
tutorialquestion
6 Posts 4 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.
  • I Offline
    I Offline
    Imtiaz Murtaza
    wrote on last edited by
    #1

    Friends, I am using Windows Vista. I want to add a shortcut to command prompt on the desktop. I want to add it in such a manner, that whenever i double click it, the command prompt should get open with Administrative privileges by default. I don't want to right click it and select "Run as Administrator". Please tell me how to do so ?

    Imtiaz

    J 1 Reply Last reply
    0
    • I Imtiaz Murtaza

      Friends, I am using Windows Vista. I want to add a shortcut to command prompt on the desktop. I want to add it in such a manner, that whenever i double click it, the command prompt should get open with Administrative privileges by default. I don't want to right click it and select "Run as Administrator". Please tell me how to do so ?

      Imtiaz

      J Offline
      J Offline
      Johpoke
      wrote on last edited by
      #2

      Well if you don't find some easy way you could always code a simple program to run it for you (with "Run as ..." from the code). I know it's possible as I did it like a year ago, but I can't remember if I used the normal CreateProcess, or some other CreateProcessAsUser or alike. I can probably dig up the code if your having trouble... :)

      //Johannes

      I 1 Reply Last reply
      0
      • J Johpoke

        Well if you don't find some easy way you could always code a simple program to run it for you (with "Run as ..." from the code). I know it's possible as I did it like a year ago, but I can't remember if I used the normal CreateProcess, or some other CreateProcessAsUser or alike. I can probably dig up the code if your having trouble... :)

        //Johannes

        I Offline
        I Offline
        Imtiaz Murtaza
        wrote on last edited by
        #3

        Would be glad if you could tell the way to do it.

        Imtiaz

        J 1 Reply Last reply
        0
        • I Imtiaz Murtaza

          Would be glad if you could tell the way to do it.

          Imtiaz

          J Offline
          J Offline
          Johpoke
          wrote on last edited by
          #4

          OK, I looked at my code, and this is what i did: system("runas /user:Administrator \"setup.exe /install /noreboot\""); Since this is a normal CMD command (whats inside the "" of system() ) you can just call it from a .bat/.cmd file. Note that it will ask you for the password each time, and i dont think you can send the password as a param. (But you could create a c++ program which emulates the keyboard pressing keys (this would be very insecure as you can easily to fetch out the password)) :)

          //Johannes

          J V 2 Replies Last reply
          0
          • J Johpoke

            OK, I looked at my code, and this is what i did: system("runas /user:Administrator \"setup.exe /install /noreboot\""); Since this is a normal CMD command (whats inside the "" of system() ) you can just call it from a .bat/.cmd file. Note that it will ask you for the password each time, and i dont think you can send the password as a param. (But you could create a c++ program which emulates the keyboard pressing keys (this would be very insecure as you can easily to fetch out the password)) :)

            //Johannes

            J Offline
            J Offline
            Jorgen Andersson
            wrote on last edited by
            #5

            There's a little program that can take care of password problem for you called sanur.exe[^] Use it like this: runas /u:domain\username \\servername\path\command.cmd | \\servername\path\sanur.exe password Or read the text in the link (several pages)

            1 Reply Last reply
            0
            • J Johpoke

              OK, I looked at my code, and this is what i did: system("runas /user:Administrator \"setup.exe /install /noreboot\""); Since this is a normal CMD command (whats inside the "" of system() ) you can just call it from a .bat/.cmd file. Note that it will ask you for the password each time, and i dont think you can send the password as a param. (But you could create a c++ program which emulates the keyboard pressing keys (this would be very insecure as you can easily to fetch out the password)) :)

              //Johannes

              V Offline
              V Offline
              Vasudevan Deepak Kumar
              wrote on last edited by
              #6

              Johpoke wrote:

              it will ask you for the password each time,

              Better.

              Johpoke wrote:

              you could create a c++ program which emulates the keyboard pressing keys (this would be very insecure as you can easily to fetch out the password))

              That would be a bad practice. Thanks for the cool code snippet. I am voting a '5'.

              Vasudevan Deepak Kumar Personal Homepage
              Tech Gossips
              A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

              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