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
| param ( | |
| [string]$ip = "8.8.8.8" | |
| ) | |
| do { | |
| $ping = Test-Connection $ip -Count 1 -ErrorAction SilentlyContinue | |
| if ($ping -eq $null) { | |
| $host.UI.RawUI.WindowTitle = "Ping: timeout" | |
| write-host "Ping $ip : timeout" | |
| } else { |
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
| function logicalpath($path) { | |
| // same as realpath() except keeps logical paths | |
| if (!file_exists($path)) { | |
| return False; | |
| } | |
| $filename = ''; | |
| if (is_file($path)) { | |
| $filename = (basename($path)); | |
| $length = strlen($filename); | |
| $path = substr($path, 0, -$length); |