Jump to content

Automatically double click an exe file


 Share

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)

 

Link to comment
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.

EndFunc
ShellExecute(@DesktopDir & "\MonthlyLog.txt")
FileClose($File)

 

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...