Skip to main content

Posts

Showing posts from May, 2015

Use SendKeys in PowerShell

Script below will use SendKeys in PowerShell, the old fashioned way.

Script below will open a Notepad and type or send some string to notepad.

It will also open windows calculator and do some calculation.

Here's the script:

#====================================

$wshell = New-Object -ComObject Wscript.Shell

#Call notepad and run it
$wshell.Run("notepad")

#Delay for 1 second
Start-Sleep -m 1000

#Send keys to notepad
$wshell.SendKeys("123 test 456")

#Delay for 2 seconds
Start-Sleep -m 2000

#Run Windows Calculator
$wshell.Run("calc")

#Set the window focus to calculator
#Don't click or press the keyboard or mouse so focus will not be changed
$wshell.appactivate("Calculator")

#sleep again for 1 second
Start-Sleep -m 1000

#Do the calculation by sending keys to calculator
$wshell.SendKeys("5")
$wshell.SendKeys("*")
$wshell.SendKeys("5")
$wshell.SendKeys("=")

#====================================

Cheers..Have fun with PowerShell…

Burn an ISO file in Windows 7 or 8

Use command line to burn an ISO file in Windows.

Windows 7 and Windows 8 comes with an exe file to burn an ISO file via command prompt.

The syntax is quite easy to remember.

Open a command prompt and type:

isoburn /q a: Windows_and_Linux.iso

isoburn /q ISOFilename.to.be.burn

That's it, ISO will be burn to disc.

See picture below if no disc on the drive, when burning an ISO file via command prompt.