Betts1964 Posted February 21, 2018 Share Posted February 21, 2018 hi, I am looking for some help with a batch job I am using the following code: @echo off "C:\Program Files\CyberGhost 6\CSF.exe" start CSF.exe pause /t 15 "C:\Program Files\CyberGhost 6\cyberghost.exe start cyberghost.exe I would like the 1st program (CSF.exe) to start right away and the next program (cyberghost.exe) to start with a 15 second delay. When i started the batch job it cant find CSF.exe program for some reason. It is in that directory though. Any help is appreciated. thx Link to comment Share on other sites More sharing options...
Whoopenstein Posted February 21, 2018 Share Posted February 21, 2018 Maybe try @echo off cd\ c:\Program Files\CyberGhost 6 start CSF.exe pause /t 15 start cyberghost.exe Cd= change directory \ = from the root directory Link to comment Share on other sites More sharing options...
Dodel Posted February 21, 2018 Share Posted February 21, 2018 1 hour ago, bergy1964 said: @echo off c: cd\ C:\Program Files\CyberGhost 6\CSF.exe start CSF.exe PING localhost -15 >NUL cd\ cd C:\Program Files\CyberGhost 6\cyberghost.exe start cyberghost.exe @echo off c: <- Ensures you're on the correct disk (root) cd\ C:\Program Files\CyberGhost 6\CSF.exe start CSF.exe PING localhost -15 >NUL (Pause only waits for a key press, it requires user input) (Pinging local host is my preferred delay method.) cd\ <- switches back to root of c: cd C:\Program Files\CyberGhost 6\cyberghost.exe start cyberghost.exe Should be somewhere close. Edit : Typo, and I am not saying the above code is correct either Link to comment Share on other sites More sharing options...
Whoopenstein Posted February 21, 2018 Share Posted February 21, 2018 18 minutes ago, Dodel said: @echo off c: <- Ensures you're on the correct disk (root) cd\ C:\Program Files\CyberGhost 6\CSF.exe start CSF.exe PING localhost -15 >NUL (Pause only waits for a key press, it requires user input) (Pinging local host is my preferred delay method.) cd\ <- switches back to root of c: cd C:\Program Files\CyberGhost 6\cyberghost.exe start cyberghost.exe Should be somewhere close. Edit : Typo. Like I said above, the command "cd\" takes you to the root. Once you have changed to a directory, you'll stay there unless you specify in your batch. Yeah, If the batch file is started from a drive other than C:, it would be good to start with the C: like Dodel said Link to comment Share on other sites More sharing options...
Dodel Posted February 21, 2018 Share Posted February 21, 2018 nvm. Link to comment Share on other sites More sharing options...
Whoopenstein Posted February 21, 2018 Share Posted February 21, 2018 2 minutes ago, Dodel said: nvm. Been a while since I've made a batch file! Link to comment Share on other sites More sharing options...
Betts1964 Posted February 22, 2018 Author Share Posted February 22, 2018 I am getting the following error: https://imgur.com/a/m2TMi Here is the folder they are located: https://imgur.com/a/09K2x Any help is appreciated. thx Link to comment Share on other sites More sharing options...
Betts1964 Posted February 22, 2018 Author Share Posted February 22, 2018 1st one worked but not the second one. Any ideas why it didnt? thx Link to comment Share on other sites More sharing options...
Betts1964 Posted February 22, 2018 Author Share Posted February 22, 2018 same results. Link to comment Share on other sites More sharing options...
Kalju Posted February 22, 2018 Share Posted February 22, 2018 Here I put the first delay to 1 sec and then the second to 15 sec. @echo off ping -n 1 127.0.0.1>nul start "CSF" "C:\Program Files\CyberGhost 6\CSF.exe" ping -n 15 127.0.0.1>nul start "CyberGhost" "C:\Program Files\CyberGhost 6\CyberGhost.exe" Link to comment Share on other sites More sharing options...
Betts1964 Posted February 22, 2018 Author Share Posted February 22, 2018 13 minutes ago, Kalju said: Here I put the first delay to 1 sec and then the second to 15 sec. @echo off ping -n 1 127.0.0.1>nul start "CSF" "C:\Program Files\CyberGhost 6\CSF.exe" ping -n 15 127.0.0.1>nul start "CyberGhost" "C:\Program Files\CyberGhost 6\CyberGhost.exe" Hi Kalju, That worked the best so far. Is there a way to have the csf program to start right away without a delay? thx so much. Link to comment Share on other sites More sharing options...
tigerjack Posted February 22, 2018 Share Posted February 22, 2018 41 minutes ago, bergy1964 said: 57 minutes ago, Adn.naw said: @echo off cd "C:\Program Files\CyberGhost 6" start CSF.exe TIMEOUT 15 cd "C:\Program Files\CyberGhost 6" start cyberghost.exe exit 1st one worked but not the second one. Any ideas why it didnt? thx no TIMEOUT 15 but timeout /T 15 I tried with two programs and it seems to work Link to comment Share on other sites More sharing options...
Betts1964 Posted February 22, 2018 Author Share Posted February 22, 2018 i also get this message https://imgur.com/a/qfnoc until i click ok and then it works? thx Link to comment Share on other sites More sharing options...
Kalju Posted February 22, 2018 Share Posted February 22, 2018 If You think, it is related to this, that was used 127.0.0.1, try this with 10.0.0.0 If you want, you can also use .vbs, it's not complicated. I can try to write one. @echo off start "CSF" "C:\Program Files\CyberGhost 6\CSF.exe" ping -n 15 10.0.0.0>nul start "CyberGhost" "C:\Program Files\CyberGhost 6\CyberGhost.exe" Link to comment Share on other sites More sharing options...
Kalju Posted February 22, 2018 Share Posted February 22, 2018 For example something like this: Set Shell = WScript.CreateObject("Wscript.Shell") WScript.Sleep(1000) Shell.Run """%ProgramFiles%\CyberGhost 6\CSF.exe""", 1, False WScript.Sleep(15000) Shell.Run """%ProgramFiles%\CyberGhost 6\CyberGhost.exe""", 1, False rem True=wait until exits rem Window: 0=hidden, 1=normal, 2=minimized rem Shell.Run """CSF.exe"" ""argument with space""", 1, False rem Shell.Run "CyberGhost.exe """ & WScript.Arguments.Item(0) & """", 1, True NB! Do not forget that .vbs must be saved as Unicode Link to comment Share on other sites More sharing options...
Betts1964 Posted February 22, 2018 Author Share Posted February 22, 2018 21 minutes ago, Kalju said: For example something like this: Set Shell = WScript.CreateObject("Wscript.Shell") WScript.Sleep(1000) Shell.Run """%ProgramFiles%\CyberGhost 6\CSF.exe""", 1, False WScript.Sleep(15000) Shell.Run """%ProgramFiles%\CyberGhost 6\CyberGhost.exe""", 1, False rem True=wait until exits rem Window: 0=hidden, 1=normal, 2=minimized rem Shell.Run """CSF.exe"" ""argument with space""", 1, False rem Shell.Run "CyberGhost.exe """ & WScript.Arguments.Item(0) & """", 1, True NB! Do not forget that .vbs must be saved as Unicode yes, they both work but it still says "service is not reachable. Any ideas y? thx Link to comment Share on other sites More sharing options...
Kalju Posted February 22, 2018 Share Posted February 22, 2018 19 minutes ago, bergy1964 said: yes, they both work but it still says "service is not reachable. Any ideas y? thx The only idea is that for some other reason, this service will not start at the right time or correctly, open%windir%\system32\services.msc (or Windows Administrative Tools folder or control panel). and see if this service is there and whether it's an auto start or manual. If is the auto start, then right click on the service and Properties and then Recovery table, there should be two starts (startups), if the first time does not start, then restart after a minute. (it should be the second selection there). This is the first idea. Link to comment Share on other sites More sharing options...
Betts1964 Posted February 22, 2018 Author Share Posted February 22, 2018 8 minutes ago, Kalju said: The only idea is that for some other reason, this service will not start at the right time or correctly, open%windir%\system32\services.msc (or Windows Administrative Tools folder or control panel). and see if this service is there and whether it's a auto start or manual. If is the auto start, then right click on the service and Properties and then Recovery table, there should be two starts (startups), if the first time does not start, then restart after a minute. (it should be the second selection there). This is the first idea. That didnt work. but thx. Link to comment Share on other sites More sharing options...
Kalju Posted February 22, 2018 Share Posted February 22, 2018 Then my ideas ended at the moment, maybe just try to clean the junk, register, temp. Then check sfc.exe /scannow if they do not give results, then Dism check and clean up, etc. Maybe someone's a good idea. PS, this may also be related to an antivirus program, firewall, or some unpredictable thing. Link to comment Share on other sites More sharing options...
Betts1964 Posted February 22, 2018 Author Share Posted February 22, 2018 we can see if someone might be able to come up with a solution. TYVM. Link to comment Share on other sites More sharing options...
franco46 Posted February 22, 2018 Share Posted February 22, 2018 See if this works : - @echo off cd C:\Program Files\CyberGhost 6 start CSF.exe TIMEOUT /T 15 start cyberghost.exe exit If the 2nd part does not run, add this line "cd C:\Program Files\CyberGhost 6" before start cyberghost.exe One more point, are these 2 exe files can run simultaneously ? Link to comment Share on other sites More sharing options...
Whoopenstein Posted February 22, 2018 Share Posted February 22, 2018 OK, I messed up with my previous post. You can try this if you want. You may want to run as Administrator. CGrun.zip Link to comment Share on other sites More sharing options...
Betts1964 Posted February 22, 2018 Author Share Posted February 22, 2018 Kalju and whoopensteins work great. With Kalju's it leaves a log leftover that i prefer it didnt. Is there a way to avoid that? Whoop, on yours, it doesnt close out the dos window when finished. Can that be fixed? I am very sorry to nitpick. That is just the way i am. If it is too much work for either of you, dont worry about. I really appreciate all the work each and every one of you who have helped me in any way. thx Link to comment Share on other sites More sharing options...
Whoopenstein Posted February 22, 2018 Share Posted February 22, 2018 Try this one. It will run the two programs minimized and should exit after finished (I hope) CGrun2.zip Link to comment Share on other sites More sharing options...
Betts1964 Posted February 22, 2018 Author Share Posted February 22, 2018 32 minutes ago, Whoopenstein said: Try this one. It will run the two programs minimized and should exit after finished (I hope) CGrun2.zip Perfection...TYVM Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.