ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Need help with a batch file

    IT Discussion
    5
    19
    3.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dbeatoD
      dbeato
      last edited by dbeato

      You can also use powershell for this:

      Stop-Process -name processname -force
      Start-Sleep -Seconds 15
      Start-Process -FilePath 'C:\Program Files\processname\processname.exe'
      1 Reply Last reply Reply Quote 2
      • s.hacklemanS
        s.hackleman
        last edited by

        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.

        Tracy_BurtonT 1 Reply Last reply Reply Quote 0
        • Tracy_BurtonT
          Tracy_Burton @s.hackleman
          last edited by

          @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.

          s.hacklemanS 1 Reply Last reply Reply Quote 0
          • s.hacklemanS
            s.hackleman @Tracy_Burton
            last edited by s.hackleman

            @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.

            1 Reply Last reply Reply Quote 0
            • Tracy_BurtonT
              Tracy_Burton
              last edited by

              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.

              dafyreD 1 Reply Last reply Reply Quote 0
              • s.hacklemanS
                s.hackleman
                last edited by

                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_BurtonT 1 Reply Last reply Reply Quote 1
                • dafyreD
                  dafyre @Tracy_Burton
                  last edited by

                  @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.

                  Tracy_BurtonT 1 Reply Last reply Reply Quote 1
                  • Tracy_BurtonT
                    Tracy_Burton @s.hackleman
                    last edited by

                    @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.

                    1 Reply Last reply Reply Quote 0
                    • Tracy_BurtonT
                      Tracy_Burton @dafyre
                      last edited by

                      @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.

                      dafyreD 1 Reply Last reply Reply Quote 0
                      • dafyreD
                        dafyre @Tracy_Burton
                        last edited by

                        @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.

                        Tracy_BurtonT 1 Reply Last reply Reply Quote 0
                        • Tracy_BurtonT
                          Tracy_Burton @dafyre
                          last edited by

                          @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?
                          0_1504028546039_script.jpg

                          dafyreD 1 Reply Last reply Reply Quote 0
                          • dafyreD
                            dafyre @Tracy_Burton
                            last edited by

                            @tracy_burton Yepp!

                            Tracy_BurtonT 1 Reply Last reply Reply Quote 0
                            • Tracy_BurtonT
                              Tracy_Burton @dafyre
                              last edited by Tracy_Burton

                              @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!

                              1 Reply Last reply Reply Quote 0
                              • Emad RE
                                Emad R @Tracy_Burton
                                last edited by

                                @tracy_burton

                                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.

                                Tracy_BurtonT 1 Reply Last reply Reply Quote 0
                                • Tracy_BurtonT
                                  Tracy_Burton @Emad R
                                  last edited by

                                  @emad-r said in Need help with a batch file:

                                  @tracy_burton

                                  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.

                                  1 Reply Last reply Reply Quote 0
                                  • 1 / 1
                                  • First post
                                    Last post