[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1585
  • Last Modified:

.bat file does not run correctly in Task Scheduler

I have a .application application that runs fine when clicked manually and when called with a .bat file manually, but when executed from Task manager it fails to run.
0
DJ_Consulting
Asked:
DJ_Consulting
  • 3
  • 3
  • 2
  • +2
1 Solution
 
Scott ThomsonCommented:
Can you give the code for the bat file and what happens when you try to run it manually if there is an error etc.?
0
 
Joe Winograd, EE MVE 2015&2016DeveloperCommented:
It may need to run elevated. Go into Properties of the task, then the General tab, and tick the box in the Security Options section that says "Run with highest privileges". It should look like this:

Task Scheduler run elevatedRegards, Joe
0
 
Sam Simon NasserCommented:
try this command in task manager
runas /savecred /profile /user:Administrator whateveryouwanttorun.bat

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
DJ_ConsultingAuthor Commented:
When I run the bat file manually  there is no error.   When I run the program, a .application file manually there is no error.  

If I try to run the .application file in task manager it says not valid  win32 application.

I already have run with highest privileges checked.  

I tried the runas command gives me "The operation completed successfully. (0x0) in task manager but the application doesn't actually run.  The same as when I just have it run the bat directly.

The code in the BAT file is just
autosnapshot.application

Open in new window

0
 
Sam Simon NasserCommented:
not valid  win32 application

Open in new window

this means you don't have .net framework! or a framework that is least from whats the software is built on
0
 
_Commented:
Hmmm... have you tried it with the full Pathname, in the .BAT file
0
 
DJ_ConsultingAuthor Commented:
Yes, I do have the .net framework.  The program runs perfectly when clicked or run from the commandline.  @Sam Simon Nasser

I have tried with the full pathname in the .bat file @coral147.  I've googled around and this seems to be a common thing, but I have found no solutions anywhere.
0
 
_Commented:
hmmm...

dumb question: does it have to be run from the .BAT file?
Can you run autosnapshot.application directly in Task Manager?

edit:
never mind, I just saw the post where is says you tried this already
0
 
DJ_ConsultingAuthor Commented:
It appears to have worked.  Thank you!  I did have to change it to

runas "/savecred /profile /user:administrator whateveryouwanttorun.bat"

Not sure why, I think because of the spaces.  It was just a guess when it errored out and it worked.
0
 
_Commented:
nice.     : )
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now