We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f0b7f8c commit e4e056eCopy full SHA for e4e056e
Core/Functions/Clipboard.ps1
@@ -0,0 +1,25 @@
1
+# Function to copy text to the clipboard
2
+function Copy-ToClipboard {
3
+ param (
4
+ [Parameter(ValueFromPipeline=$true)]
5
+ [string]$text
6
+ )
7
+
8
+ begin {
9
+ $sb = [System.Text.StringBuilder]::new()
10
+ }
11
12
+ process {
13
+ $sb.AppendLine($text) | Out-Null
14
15
16
+ end {
17
+ if ($PSVersionTable.PSVersion.Major -lt 5) {
18
+ Write-Error "Your version of PowerShell does not support Set-Clipboard."
19
+ return
20
21
22
+ Set-Clipboard -Value $sb.ToString()
23
+ Write-Host "The content has been copied to the clipboard."
24
25
+}
0 commit comments