WinAPIExec is a tiny but very powerful tool which allows you to run Windows API functions from the command line, giving your scripts access to all kinds of powerful functionality.

If you're not a programmer then figuring out how to use this will be far from straightforward, but fortunately the program comes with some interesting examples to give you some idea.

To eject your CD ROM, for instance, you'd use this (all commands must be entered on one line):
winapiexec.exe winmm.dll@mciSendStringW "open cdaudio" 0 0 0 , winmm.dll@mciSendStringW "set cdaudio door open" 0 0 0 , winmm.dll@mciSendStringW "close cdaudio" 0 0 0

This command programmatically displays the Start menu:
winapiexec.exe u@SendMessageW ( u@FindWindowW Shell_TrayWnd 0 ) 0x111 305 0

You get considerable control over processes. This line launches Notepad, pauses for 5 seconds, then closes it:
winapiexec.exe CreateProcessW 0 notepad 0 0 0 0x20 0 0 $a:0x44,,,,,,,,,,,,,,,, $b:16 , Sleep 5000 , TerminateProcess $$:11@0 0

You're able to collect and display useful Windows-related information. This line shows you the current Temp path, for instance:
winapiexec.exe GetTempPathW 260 $b:520 , u@MessageBoxW 0 $$:3 $$:0 0x40

There are several other useful examples in the program's readme.txt file. And these are just the beginning: once you understand how the program works, then you can quickly come up with others to do a whole lot more.


WinAPIExec provides an easy way to supercharge your batch files with all kinds of new features and functionality