Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to schedule a batch file to run through a third party application, however the output file doesn't get created in the directory. If I run the .BAT file from the command line, it works and the file gets created. Also using the Windows Schedule will also succeed.

Basically, the 3rd party software will schedule the .BAT file and it shows success within the 3rd party user interface. The difference between running from the command prompt and the software, is that the software will use its Windows service to launch the batch.

The 3rd party software will show success since it was able to successfully call the .BAT file to run, however it has no control of the other EXE's that's being called within the script.

I'm able to run a simple .BAT file in the 3rd party software, for example a copy command.

The .BAT I'm having problems with calls a compiled EXE which launches Excel to create a file to a location.

The .bat file calls something.exe, which then calls Excel.exe:

C:\something.exe -o D:\filename.xlsm C:\filename.xlsm refresh_pivot

Do you think it's a permissions issue? I used Process Monitor to verify any Access Denied errors but everything seems to be working according to the trace. It worked on a non-64-bit OS, I'm currently using Win2008 64-bit.

share|improve this question
    
i'm going with a command syntax issue, but i'm not sure –  hbdgaf Dec 9 '10 at 0:52
    
Try not writing the output file to the root of C:, but a subdirectory instead. –  ultrasawblade Apr 16 at 14:33

2 Answers 2

What user credentials is the Scheduled Task running under? Has Excel been run and configured under that user account? My gut says that's where things are falling down -- Office hasn't been through its first run on the account running the batch file.

share|improve this answer

Afrazier is probably on the right track. You can test this by using the runas command from the command prompt and test running the batch file with the same account that the service uses. This would be a much better test than simply running the batch file from the command prompt under your user account or administrator.

The command would look something like this: C:\> runas /user:DOMAIN\service_acct "scheduled.bat"

I would also try substituting the actual something.exe command for the batch file and see if that has any different output, ie- C:\> runas /user:DOMAIN\service_acct "something.exe -o D:\filename.xlsm C:\filename.xlsm refresh_pivot"

That might give you a better understanding of what is going on. If an access denied error happens then it's definitely a permissions thing. You can try just typing runas at the prompt to see other options as well.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.