Solved

.bat file does not run correctly in Task Scheduler

Posted on 2014-03-24
10
1,533 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
ID: 39952293
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 53

Expert Comment

by:Joe Winograd, EE MVE
ID: 39952444
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
ID: 39952518
try this command in task manager
runas /savecred /profile /user:Administrator whateveryouwanttorun.bat

Open in new window

0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:DJ_Consulting
ID: 39953947
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
ID: 39953989
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
 
LVL 32

Expert Comment

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

Author Comment

by:DJ_Consulting
ID: 39954040
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:_
ID: 39954079
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
ID: 39954650
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:_
ID: 39954727
nice.     : )
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

First some basics on Windows 7 Backup.  It has 2 components one is a file based backup which is stored in .zip files each zip is split at around 200 Megabytes and there is the Image Backup which is as the name implies a total image of the partition …
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…

685 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