Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName Microsoft.VisualBasic
Start-Process -FilePath "explorer.exe"
# Wait for WinWord to open and become active
Start-Sleep -Seconds 1
(New-Object -ComObject "wscript.shell").SendKeys("^{l}")
Start-Sleep -Seconds 1
(New-Object -ComObject "wscript.shell").SendKeys("D:\")
Start-Sleep -Seconds 1
(New-Object -ComObject "wscript.shell").SendKeys("{Enter}")
#Context menu with Powershell
[System.Windows.Forms.SendKeys]::SendWait("^+{F10}")
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait("^+n")
Start-Sleep -Seconds 1
(New-Object -ComObject "wscript.shell").SendKeys("{Enter}")
No comments:
Post a Comment