Solved

.bat file does not run correctly in Task Scheduler

Posted on 2014-03-24
10
1,487 Views
Last Modified: 2014-03-25
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
Comment
Question by:DJ_Consulting
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 10

Expert Comment

by:Scott Thomson
Comment Utility
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
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
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
 
LVL 10

Accepted Solution

by:
Sam Simon Nasser earned 500 total points
Comment Utility
try this command in task manager
runas /savecred /profile /user:Administrator whateveryouwanttorun.bat

Open in new window

0
 

Author Comment

by:DJ_Consulting
Comment Utility
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
 
LVL 10

Expert Comment

by:Sam Simon Nasser
Comment Utility
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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 32

Expert Comment

by:_
Comment Utility
Hmmm... have you tried it with the full Pathname, in the .BAT file
0
 

Author Comment

by:DJ_Consulting
Comment Utility
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
 
LVL 32

Expert Comment

by:_
Comment Utility
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
 

Author Closing Comment

by:DJ_Consulting
Comment Utility
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
 
LVL 32

Expert Comment

by:_
Comment Utility
nice.     : )
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Image capture and Deploy method is consist on two phases. In our first phase we capture the image of windows from the PC in which Windows and others softwares are already installed. In second phase we deploy the created image on new PC in which we…
One of the features I've come to appreciate about Windows 7 and Windows Server 2008 R2 is the ability to pin applications to the task bar. As useful a feature as I've found this, it does have some quirks.  For example, have you ever tried pinning an…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now