PowerShell, 130 바이트
Add-Type -A System.Device;($a=[Device.Location.GeoCoordinateWatcher]::new()).Start();for(;($b=$a|% Po*n|% L*)|% I*){}$b|select L*e
언 골프 드 :
Add-Type -AssemblyName System.Device #Required to access System.Device.Location namespace
$GeoWatcher = New-Object System.Device.Location.GeoCoordinateWatcher #Create the required object
$GeoWatcher.Start() #Begin resolving current locaton
whille ($GeoWatcher.Status -ne "Ready") do { sleep -Milliseconds 100 } #Wait for discovery.
$GeoWatcher.Position.Location | Select Latitude,Longitude #Select the relevent results.
다음과 같이 반환됩니다.
PS C:\users\sweeneyc\Desktop> Add-Type -A System.Device;($a=[Device.Location.GeoCoordinateWatcher]::new()).Start();for(;($b=$a|% Po*n|% L*)|% I*){}$b|select L*e
Latitude Longitude
-------- ---------
53.4064177191653 -6.36202495701332
이 작업을 수행 할 수있는 방법이 있지만 그렇게 예쁘지는 않습니다.
보너스 : 현재 위치에서 Google지도를 엽니 다.
Add-Type -A System.Device;($a=[Device.Location.GeoCoordinateWatcher]::new()).Start();for(;($b=$a|% Po*n|% L*)|% I*){};saps "https://www.google.ie/maps/@$($b.Latitude),$($b.Longitude)z"
를 사용하여 3 바이트를 절약 할 수 TryStart있지만 true파이프 라인에 a 를 출력하고 그것을 억제하는 데 더 많은 비용이 듭니다.
Add-Type -A System.Device;($a=[Device.Location.GeoCoordinateWatcher]::new()).TryStart($true,[int]9e8);$a|% Po*n|% L*|select L*e
PowerShell (비경쟁), 44 바이트
(irm freegeoip.net/xml).Response|select *ude
PowerShell에는 '현재 위치'에 대한 내부 기본 제공 기능이 없으므로 외부 서비스를 사용합니다. IP 기반 지리적 위치이므로 실제 위치를 거의 반환하지 않으며 ISP의 '기본'위치를 반환합니다. VPN을 통해이 지점이 어디든지 존재합니다.
무선 맥 주소 지리 위치 측정 방법으로 작동하기 위해 Google지도 API를 얻으려고 (골프 연습이 아닌) 시도했지만 정확하지는 않습니다.
결과의 부정확성으로 인해 비경쟁으로 표시되었습니다.
PS C:\Users\sweeneyc> (irm freegeoip.net/xml).Response|select *ude
Latitude Longitude
-------- ---------
53.3472 -6.2439
이것은 Central Dublin, Ireland검색 할 때 표시 되지만 반환 된 지점에서 약 8 마일 떨어진 도심에서 약간 떨어져 있습니다.
gl에 대한Get-Location슬프게도 나는 생각하지 않는다,C:\Users\Connor당신은 매우 많은 숲을 탈출하는 데 도움이됩니다.