Need help with a batch file
-
To avoid this we run programs like this as a scheduled task. So the program runs the process once then closes. Then you schedule it to run every 15-60 minutes. You can this watch your logs and alarm if the process ends in an error code. Just a different way to skin the same cat.
-
@s-hackleman
This won't work as it needs to be running all the time. As transactions come into the collection server, they need to be posted to the ERP server immediately. -
@tracy_burton said in Need help with a batch file:
@s-hackleman
This won't work as it needs to be running all the time. As transactions come into the collection server, they need to be posted to the ERP server immediately.To solve that we use staging and queue tables in SQL. Sounds like you have the best solution for this issue, just sucks that it gets hung so often.
-
I got the batch script and thought everything was fine but it's still not working. I think this is an issue with this specific program so I'm not sure anyone here can help but I'll explain whats happening.
When it launches, it has some associated preferences with it (the correct location to post to, etc). I can double click on the batch file and it runs perfectly as long as its located in the program folder where the exe file lives. When I setup the task scheduler, I pointed it directly to the correct Program Files folder but it doesn't launch with those associated preferences. I manually run it and its fine but the task scheduler is missing something.
-
Sounds like permissions would be the first place I would look. Does task scheduler attempt to run the program as you, or as a service account?
-
@tracy_burton said in Need help with a batch file:
I got the batch script and thought everything was fine but it's still not working. I think this is an issue with this specific program so I'm not sure anyone here can help but I'll explain whats happening.
When it launches, it has some associated preferences with it (the correct location to post to, etc). I can double click on the batch file and it runs perfectly as long as its located in the program folder where the exe file lives. When I setup the task scheduler, I pointed it directly to the correct Program Files folder but it doesn't launch with those associated preferences. I manually run it and its fine but the task scheduler is missing something.
Does the task need to run as a particular user?
Also, check the working directory in the Scheduled Job...
You can also try and CD to the right directory at the start of the batch file.
-
@s-hackleman said in Need help with a batch file:
Sounds like permissions would be the first place I would look. Does task scheduler attempt to run the program as you, or as a service account?
I have it set to run as administrator so there should be no permission issues but I'll take a look.
-
@dafyre said in Need help with a batch file:
@tracy_burton said in Need help with a batch file:
I got the batch script and thought everything was fine but it's still not working. I think this is an issue with this specific program so I'm not sure anyone here can help but I'll explain whats happening.
When it launches, it has some associated preferences with it (the correct location to post to, etc). I can double click on the batch file and it runs perfectly as long as its located in the program folder where the exe file lives. When I setup the task scheduler, I pointed it directly to the correct Program Files folder but it doesn't launch with those associated preferences. I manually run it and its fine but the task scheduler is missing something.
You can also try and CD to the right directory at the start of the batch file.
I don't think this is the issue since it does run the batch script so it knows where to find it. -
@tracy_burton said in Need help with a batch file:
@dafyre said in Need help with a batch file:
@tracy_burton said in Need help with a batch file:
I got the batch script and thought everything was fine but it's still not working. I think this is an issue with this specific program so I'm not sure anyone here can help but I'll explain whats happening.
When it launches, it has some associated preferences with it (the correct location to post to, etc). I can double click on the batch file and it runs perfectly as long as its located in the program folder where the exe file lives. When I setup the task scheduler, I pointed it directly to the correct Program Files folder but it doesn't launch with those associated preferences. I manually run it and its fine but the task scheduler is missing something.
You can also try and CD to the right directory at the start of the batch file.
I don't think this is the issue since it does run the batch script so it knows where to find it.
Right, but when it runs the batch script, unless you have set the Working Directory ("Start in" on the screen), it's just going to run the batch file form probbably C:\Windows\System32 or something like that.
-
@dafyre said in Need help with a batch file:
@tracy_burton said in Need help with a batch file:
@dafyre said in Need help with a batch file:
@tracy_burton said in Need help with a batch file:
I got the batch script and thought everything was fine but it's still not working. I think this is an issue with this specific program so I'm not sure anyone here can help but I'll explain whats happening.
When it launches, it has some associated preferences with it (the correct location to post to, etc). I can double click on the batch file and it runs perfectly as long as its located in the program folder where the exe file lives. When I setup the task scheduler, I pointed it directly to the correct Program Files folder but it doesn't launch with those associated preferences. I manually run it and its fine but the task scheduler is missing something.
You can also try and CD to the right directory at the start of the batch file.
I don't think this is the issue since it does run the batch script so it knows where to find it.
Right, but when it runs the batch script, unless you have set the Working Directory ("Start in" on the screen), it's just going to run the batch file form probbably C:\Windows\System32 or something like that.
I think I see where you're going. Are you talking about what I'm pointing to in this screenshot?
-
@tracy_burton Yepp!
-
@dafyre said in Need help with a batch file:
@tracy_burton Yepp!
So in that field I should be putting CD "C:\Program Files (x86)\Consona\Made2Manage Client\BCP",. correct? When I do, the task won't even run.
I also did it without the "CD" in front and nothing. I removed the quotes and it worked...Stupid crap!
-
how do you solve it when it gets hung ? via task manager --> end process, if that is the case and this is working for you, then batch file will work.
However I would investigate (when I have free time) how ERP software gets feeded (mysql/basic files/what connector it uses) and see if I can try to further understand to help solve the issue.
Secondly, try replacing that Win 7 with 2008R2, and check if program runs more stably using that. I reckon there is still a way to trial 2008R2.
-
@emad-r said in Need help with a batch file:
how do you solve it when it gets hung ? via task manager --> end process, if that is the case and this is working for you, then batch file will work.
However I would investigate (when I have free time) how ERP software gets feeded (mysql/basic files/what connector it uses) and see if I can try to further understand to help solve the issue.
Secondly, try replacing that Win 7 with 2008R2, and check if program runs more stably using that. I reckon there is still a way to trial 2008R2.
The new version of the ERP software runs on .net so once the upgrade is done, I don't anticipate this being an issue. It honestly is just really bad software and this is an "add-on" piece that no one in support even knows about. I've invested many many hours into trying to fix it and I'm done wasting my time. This will suffice for now.