0
Most of the questions relating to this seem to be centered on hiding the command prompt window when running a batch file at startup. I seem to be having the opposite problem.
I'm trying to run a batch file on startup as an administrator, and without having to click through the UAC prompt. I have followed the instructions here, and have set up a scheduled task to invoke a batch file. The thing is, I cannot get a command prompt to start and remain open. If I have a command line such as:
cmd /c "C:\Users\JoeBloggs\Batch\BackgroundBatchTask.bat"
and I run it from Start/Run
, it opens a command window and invokes the batch file, which is what I want (BackgroundBatchTask.bat
is a batch file that never exits). If I create a task to be run at startup with highest privileges and use the same command line, when I test it by right-clicking on the task and selecting "run", I see the task start in the task manager, but there is no window. What could my problem be? (and yes, the hidden
checkbox is not checked).
is your account standard user account and no admin account? here Windows runs the cmd in a new session and so you can't see it – magicandre1981 – 2015-11-03T05:31:51.407
Thanks @magicandre1981. The account is an admin one. I must confess I am a bit hazy (well a lot hazy actually) on the difference between running an application with admin privileges, and running an application when logged in as an administrator. As I want to run this task at startup - at which time presumably no-one is logged in - maybe that is affecting how Windows presents the application when it is started from the "Run" context menu of the scheduled tasks. – rossmcm – 2015-11-03T20:34:41.433
yes, this is your issue. Run it at logon of your admin user, but no at start – magicandre1981 – 2015-11-04T05:19:07.913
Ok, but what if I want the task to be started on starting windows? Do I need to use
runas
in that case? – rossmcm – 2015-11-04T07:58:30.280