I want my powershell/batch/vbscript to be able to copy a text start notepad and then paste it I found how to copy which is here but I don’t know how to paste it any ideas how can I do it without third party tools?
1 Answer
This is a very common thing. A quick web search would show you many.
powershell 'capture and send output to notepad'
Just use SendKeys and pass CRTL+V.
Pass your content to the clipboard
Example:
Get-NetIPConfiguration | clip | notepad
Sleep -Seconds 1
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.SendKeys]::SendWait('^V')
Or use other pre-built examples that already exist for this use case as shown in the link provided.
-
I'd like to suggest using
scb
alias toSet-ClipBoard
instead of usingClip.exe
. Commented Aug 20, 2021 at 1:47 -
1
Security Alert: For security purposes, the following points should be kept in mind. Paste operations need to be user initiated (Ctrl-V, Paste Menu).