Last active
February 16, 2023 16:06
-
-
Save jnnsrctr/5fa42f7b976225641382d11b45a6fd03 to your computer and use it in GitHub Desktop.
Start Chrome, but only if the VPN is connected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
netsh interface show interface name="Ethernet 2" ^ | |
|find "Connect state" ^ | |
|find "Connected">nul ^ | |
&& start "" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" ^ | |
|| "C:\Program Files (x86)\Common Files\Pulse Secure\JamUI\Pulse.exe" -show | |
close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ipconfig /all | grep -iE "ethernet|adapter|description|media state"
and find the interface that represents your VPN. If media state is not logged for one of the interfaces, the interface is normally connected.My output (truncated):
Ethernet adapter Ethernet 2:
Description . . . . . . . . . . . : Juniper Networks Virtual Adapter
For my example, the interface name is
Ethernet 2
cmd.exe /C "path-to-your-batchfile"
. This way, the Chrome icon is easily preserved, and reversing is easy, too.Be aware that
-show
is a program-specific command for Pulse Secure.