Jump to content

Automatically double click an exe file

Recommended Posts


I know I'm going to kick myself for asking this but I can't find the answer anywhere.

I have a compiled exe program that creates a notepad file on the desktop. But clients are complaining about having to double click the file to open it. They want it to automatically pop up open on the desktop. How do I automatically double click it?

The file open command is -

$colItems = ""
$objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\localhost\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", 0x30)
If IsObj($colItems) then
$File = FileOpen("MonthlyLog.txt", 2 + 8 + 128)
For $objItem In $colItems
FileWrite($File, "Running from:" & @ScriptDir & " " & "(" & @HOUR & ":" & @MIN & ":" & @SEC & " - " & @MON & "/" & @MDAY & "/" & @YEAR & ")" & @CRLF)


Share this post

Link to post
Share on other sites

Thanks. I'm doing more than kicking myself. there's quite a few swear words floating around here. I am so cheesed off at myself for being so stupid.  I would have read that particular help file a dozen times.

I added it to the end of the program and hey it works like a dream.

ShellExecute(@DesktopDir & "\MonthlyLog.txt")



Share this post

Link to post
Share on other sites

We've all been there and done that. Glad to help.

  • Like 1

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.