Thursday, January 15, 2026

How to copy and paste in Powershell from one notepad to another notepad - CTRL + C and CTRL + V in Powershell - CTRL C in Powershell and CTRL V in Powershell

 #Note This first line is mandatory 


[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")


# Start WinWord (if not already running)

Start-Process -FilePath "notepad.exe"

# Wait for WinWord to open and become active


Start-Sleep -Seconds 3

Start-Process -FilePath "notepad.exe"


Start-Sleep -Seconds 3

# Activate the WinWord window (adjust the title if necessary)

[System.Windows.Forms.SendKeys]::SendWait("123")

Start-Sleep -Seconds 3

[System.Windows.Forms.SendKeys]::SendWait("^{a}")

Start-Sleep -Seconds 3

[System.Windows.Forms.SendKeys]::SendWait("^{C}")

Start-Sleep -Seconds 3

[System.Windows.Forms.SendKeys]::SendWait("%{TAB}")


Start-Sleep -Seconds 3

[System.Windows.Forms.SendKeys]::SendWait("^{v}")



Note: ctrl C and Ctrl v , c and v are in small letters.

No comments:

Post a Comment