Created
December 11, 2024 01:59
-
-
Save Tcip/9287b5d639b62d4954df4e7ee043f7fc to your computer and use it in GitHub Desktop.
Here document in PowerShell
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
$doc, $marty = 'Dr. Emmett Brown', 'Marty McFly' | |
$time = [DateTime]'Friday, October 25, 1985 8:00:00 AM' | |
$diff = New-TimeSpan -Minutes 25 | |
@" | |
$doc : Are those my clocks I hear? | |
$marty : Yeah! Uh, it's $($time.Hour) o'clock! | |
$doc : Perfect! My experiment worked! They're all exactly $($diff.Minutes) minutes slow. | |
$marty : Wait a minute. Wait a minute. Doc... Are you telling me that it's $(($time + $diff).ToShortTimeString())? | |
$doc : Precisely. | |
$marty : Damn! I'm late for school! | |
"@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output
Dr. Emmett Brown : Are those my clocks I hear?
Marty McFly : Yeah! Uh, it's 8 o'clock!
Dr. Emmett Brown : Perfect! My experiment worked! They're all exactly 25 minutes slow.
Marty McFly : Wait a minute. Wait a minute. Doc... Are you telling me that it's 08:25?
Dr. Emmett Brown : Precisely.
Marty McFly : Damn! I'm late for school!
How to execute the PowerShell script
CMD
powershell .'Marty McFly (here-strings).ps1'
PowerShell
.'Marty McFly (here-strings).ps1'