Shortcut to Command Prompt
-
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
-
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
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
-
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
Would be glad if you could tell the way to do it.
Imtiaz
-
Would be glad if you could tell the way to do it.
Imtiaz
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
-
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
-
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
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