1

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.

2
  • i'm going with a command syntax issue, but i'm not sure Dec 9, 2010 at 0:52
  • Try not writing the output file to the root of C:, but a subdirectory instead.
    – LawrenceC
    Apr 16, 2014 at 14:33

1 Answer 1

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .