Get-GoogleDirections.ps1
19 Sep 2025Description
Get-GoogleDirections
is a convenience function that opens Google Maps in your default browser with driving directions between two points. Provide origin and destination strings and the script builds the URL and launches it with Start-Process
.
Usage examples
Get-GoogleDirections -From 'London' -To 'Manchester'
Get-GoogleDirections -From 'EC2A 2BA' -To 'Heathrow Airport'
The parameters accept any URL-encoded string accepted by Google Maps, so you can supply postcodes, cities, or full street addresses.
Script
function Get-GoogleDirections {
param([string] $From, [String] $To)
process {
Start-Process "https://www.google.com/maps/dir/$From/$To/"
}
}
Download
Please feel free to copy parts of the script or if you would like to download the entire script, simple click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.
Report Issues
You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.