Jump to content

How to call command window running as admin from the startup group?


silvergs

Recommended Posts

I need to have a command in the Startup group on my Windows Vista 64 bit machine so that it launches a command window running as the administrator and calls a simple batch file to run a program.

Can someone please tell me how to do this?

TIA!

Link to comment
Share on other sites


in your batch file, you could use the runas command.

or: go to start >> Accessories

right click on the command prompt shortcut and create a shortcut/send it to desktop. Now right click on the shortcut you just created, and open the properties dialog.

go to the "shortcut" tab and click the "advanced" button. A small form will open where you can tick the "Run as Administrator" check box. Use this shortcut to launch your batch.

If you are using this as a login / start up script, then why not do it the proper way?

go Start >> Computer

right click and do "Manage"

open the "local Users and groups" branch, in the Users folder, find the user account you want the script to run on, right click and do "Properties"

Select the "Profile" tab, and put the path to your logon script in the appropriate box there. If you want the script to run for everyone, then you would apply it to the machine instead of a user, obviously.

Hope this helps :)

Link to comment
Share on other sites

Thanks for the reply FthrJack!

I am a tad confused by your reply, so let me rephrase more clearly what I am attempting to do and then perhaps it will make more sense.

I run a program called Folding@Home and the version I am running cannot run as a service (not yet anyway). This simply means that whenever the pc is restarted for whatever reason, I have to launch that program manually.

Here is what I have to do to launch it manually:

I click Start, right-click on the Command Window program, choose run as administrator

When the command window opens, I type in cd.. and hit enter and then do that one more time to go the root of the C drive

I then cd to FAH

I finally type in the name of the executable file - "fah -smp" where -smp is a flag to run the program in high performance mode.

Which now explains why I need to run some command in the Startup group that opens a command window (running it as the admin) and then goes to the folding@home directory and calls the executable. Just so that if the pc restarts for whatever reason, I don't have to do run my program manually.

Your explanation seems to answer part of my needs but not 100% . Does that make sense?

Link to comment
Share on other sites

Well, aside from your inefficiency at using the command prompt (you could simply type C:\fah\fah.exe -smp from anywhere and have it work, or at least cd \fah and then run fah -smp), you do not need the command prompt as admin, you only need fah.exe to run as admin (by running the cmd as admin you're launching anything from there as an admin, but that's an extra step you don't actually need).

I second the runas prompt - if you perhaps wanted to do this in vbscript, there are code samples on the forums that will run a vbscript as administrator (and thus launch anything run by the vbscript as admin). That might work for you as well if you want to tackle it.

Link to comment
Share on other sites

Well, aside from your inefficiency at using the command prompt (you could simply type C:\fah\fah.exe -smp from anywhere and have it work, or at least cd \fah and then run fah -smp), you do not need the command prompt as admin, you only need fah.exe to run as admin (by running the cmd as admin you're launching anything from there as an admin, but that's an extra step you don't actually need).

The program has to be run in a command window - it is a console program. It is not a GUI based program. It won't run from anywhere.

Please help me make this seemingly very simple task work. Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...