Help with using Task Scheduler to open a program/file

Luke Boobyer

Reputable
Oct 15, 2014
12
0
4,510
Hi I have been trying to use Task Scheduler to open a program or a file but I can't quite get it to work, and I am now going around in circles after having worked on this problem all day.

The issue is that Task Scheduler manages to run the program but not fully. I can see that the program is running in task manager but not in my window. I have tried opening various programs and they all run, but I can only see it running in the task manager. I need it to open fully so I can actually use it.

Currently all I am trying to do is open Command Prompt.

Within my Task Scheduler task I am using the following settings (I have only included the ones I thought might be relevant to this issue)

General tab:
Run whether user is logged on or not
Run with highest privileges
Configure for Windows 8.1

Action tab:
Action: Start a program
Program/script: cmd

Settings
Allow task to be run on demand

I'm really at a loss now as to how I can get this to work correctly. Any assistance would be greatly appreciated.
 
Solution
What OS?

I am on Win 8 and just started task scheduler, used the wizzard, and excel just popped open at 6:17. i then added the file name with extension to the arguement field, changed "start in" to h"\users\documents" where my docuements are and excel just opened the file at 6:21 as scheduled.

What OS are you doing, I just tried and it worked fine for me.

Luke Boobyer

Reputable
Oct 15, 2014
12
0
4,510


I am trying to use Task Scheduler to simply open Command Prompt. In the end I actually want to use Task Scheduler to open an excel file on a schedule so it opens at the same time each day, but no matter what I do I always run in to this issue. So for troubleshooting reasons all I am trying to do right now is open Command Prompt by manually running a task in Task Scheduler.
 

Luke Boobyer

Reputable
Oct 15, 2014
12
0
4,510


Thanks for the reply. I tried that previously but I experience the same issue where I only see it open in the task manager.
 
you might try the command
"start cmd.exe"

otherwise I think the cmd.exe will run start the script you wanted (none listed) then automatically exit.

or maybe make a batch file like
dog.bat with the command inside.
start cmd.exe

and schedule dog.bat to run.

it is hard to say what will be run if you leave out the file extention. There is a order that windows will check first
.exe, .cmd and .BAT

and reserved names are bad name to use for a command file name. hard to confuse dog.bat as a name
cmd can have many meanings, cmd.exe the shell, cmd.bat, cmd.cmd the one that gets run will depend on your search path and your environment variables.
 

Luke Boobyer

Reputable
Oct 15, 2014
12
0
4,510


Ok in Program/script: I have cmd.exe
and then in Add arguments (optional) I added "start cmd.exe"

However the issue persists.

 

Luke Boobyer

Reputable
Oct 15, 2014
12
0
4,510
Ok I create a txt file called dog.bat and inside it I added the line start cmd.exe

I then set up a task to run this file. I ran in to the same issue where it opened the file but I could only see it open in task manager.
 
put your commands in a batch file, then when you try to run the script put the full path to the batch file
"c:\user\myname\mybatchfile.cmd"
otherwise you might have to tell the task scheduler where you base directory is located. IE where to start in to look for the batch or cmd file





 

Luke Boobyer

Reputable
Oct 15, 2014
12
0
4,510


Thanks I just tried that but I get the same results. It is still only visible in the task manager.
 

Luke Boobyer

Reputable
Oct 15, 2014
12
0
4,510


I'm pretty sure I am. The excel file is located at ‪C:\Users\Luke\Desktop\MainLinks.xlsm

That's what I was putting in the Program/script area.

I can only see it open in the task manager.

 

Luke Boobyer

Reputable
Oct 15, 2014
12
0
4,510


I just tried it with both xlsx and xls files and got the same results
 

chugot9218

Honorable
Make your target "C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE" And your argument should be C:\Users\Luke\Desktop\MainLinks.xlsm

You will need to point it to the proper location of your EXCEL.EXE if it's not at that location, it will depend on your version of Office.
 

Luke Boobyer

Reputable
Oct 15, 2014
12
0
4,510


That does appear to be where my excel is located however when I entered those values into Task Scheduler it didn't actually open Excel. There was no task in task manager.
 

Luke Boobyer

Reputable
Oct 15, 2014
12
0
4,510


I just restarted my laptop and tried your previous advice again:
target "C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE" And your argument should be C:\Users\Luke\Desktop\MainLinks.xlsm

This time it opened excel but I could only see it in task manager.

Additionally I tried your advice quoted in this message and it opened excel but again I could only find it in task manager
 
What OS?

I am on Win 8 and just started task scheduler, used the wizzard, and excel just popped open at 6:17. i then added the file name with extension to the arguement field, changed "start in" to h"\users\documents" where my docuements are and excel just opened the file at 6:21 as scheduled.

What OS are you doing, I just tried and it worked fine for me.
 
Solution

Luke Boobyer

Reputable
Oct 15, 2014
12
0
4,510


I'm using Win 8.1.

Ok I just tried setting up a new task using the basic task wizard and I was able to get it to work, Thank you for the suggestion.

Program/script: "C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE"

Add arguments (optional): C:\Users\Luke\Desktop\MainLinks.xlsm

Start in (optional): C:\Users\Luke\Desktop

However what I have narrowed it down to is the Run whether user is logged on or not option under the general tab.

With Run only when user is logged on selected it opens fine.
However if Run whether user is logged on or not is selected then I run into the problem where it opens but I can only see it in the task manager.

This is progress but the whole point of me setting this up originally was to run it when the laptop is opened from sleep automatically and without me having to log in.

 

chugot9218

Honorable
Test it out that way then, I think that because you have it set to run whether logged on or not it is running it as a service, you don't have to be at your desktop to be considered logged on, so you may not need that option.
 

Luke Boobyer

Reputable
Oct 15, 2014
12
0
4,510
I now have it set on a schedule to wake computer up from sleep at a certain time and execute the task of opening the excel workbook.

It wakes up from sleep fine but it wont open excel unless I am logged in. The run whether logged on or not option still only runs it as a service like you said.

I don't want to have to remove my password login option for my laptop so this isn't ideal, but at least the original problem of this thread has been solved. I think I'll do some searching and see if I can find a solution to this new problem. If I can't find anything I'll post another forum thread to see if anyone might have an idea about it.

Thank you to everyone who helped me investigate this issue.
 

fred3

Distinguished
Nov 7, 2011
27
0
18,530
I'm having a similar problem on Windows 8.1. I'm trying to launch a program "using the following user account" - which is different from the account that's logged in and creating the task. The programs start but don't show up in the Window.
Part of the issue is that i'm trying to open something like cmd.exe "run as administrator" and the current user is a Standard User.
So, I would check: Run whether user is logged on or not.

I tried "Run only when user is logged on" also. Then the same thing happens .. BUT .. the windows become visible if the user used for launching the program IS logged on (and switched away) .. AND .. the windows are visible if I switch back to that user's instance.
chugot9218 said:
"...you have it set to run whether logged on or not it is running it as a service, you don't have to be at your desktop to be considered logged on, so you may not need that option."
So, it appears it's a similar idea. It's running but running under another login instance.
Very confusing...