Last active
July 25, 2018 02:34
-
-
Save steviecoaster/51925745f87579fdbf3cbcb11c05c83d to your computer and use it in GitHub Desktop.
Generates a LMGTFY link from a string, and copies to clipboard.
This file contains 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 New-LMGTFYLink { | |
<# | |
.SYNOPSIS | |
Generates a Let Me Google That For You url from entered query | |
.PARAMETER Query | |
String to be searched for | |
.EXAMPLE | |
New-LMGTFY -Query "Why is the sky blue?" | |
#> | |
[cmdletbinding()] | |
Param( | |
[parameter(Mandatory,Position=0)] | |
[string]$Query | |
) | |
If($query[-1] -eq '?'){ | |
$Query = $Query -replace ('\?','%3F') | |
} | |
$query = $query -replace (' ','+') | |
$uri = "http://lmgtfy.com/?q=$query" | |
Write-Output $uri | |
Write-Output | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment