Quantcast
Channel: Microsoft forum - dslreports.com
Viewing all articles
Browse latest Browse all 8524

Help with a batch file

$
0
0
I have a batch file that works, sort of. It is called as a startup process when I boot Windows (HKLM/Run) and the purpose of the batch file is to let a few important program start (my antivirus, a few Thinkpad utility programs) and then to load my VPN client. I want to make sure the VPN software is running before I start loading other software that will use the VPN gateway, hence the conditional execution. The problem I have is that it seems to jump to the "startcoms" label and begins running the other programs whether it detects the VPN in the task list or not. When the batch file first executes it should fail to find the VPN software (because I have just booted) in which case it should load it and recheck the status every 15 seconds until success. So two questions: 1. Why does it jump ahead like that? Do I need an explicit "IF" statement or is the "&& conditional execution" structure sufficient for the purpose? 2. Are the parentheses strictly required or are they optional? @echo off REMREM Waits a few seconds for other startup tasks to complete before runningREM timeout 45 > nul REMREM Check the tasklist to insure that the VPN software has been loaded. If it has, proceed to start the other programs.REM If not, start the program and check again after 15 seconds.REM :checkvpntasklist /nh /fi "imagename eq pia_manager.exe" | find /i "pia_manager.exe" >nul && (goto startcoms)|| (start "" /min "C:\Program Files\pia_manager\pia_manager.exe")timeout 15 > nulgoto checkvpn :startcomsstart "" /min "C:\Program Files (x86)\OBIHAI\obiapp.exe"start "" /min "C:\Program Files (x86)\Skype\Phone\Skype.exe" /minimized /regrunstart "" /min "C:\Program Files (x86)\CounterPath\Bria 3\Bria3.exe"

Viewing all articles
Browse latest Browse all 8524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>