| command$ - file, program or URL to open |
|
Opens a file, program or web address with its associated Windows application. ExecFile hands the name to Windows the same way double-clicking it in Explorer would: an .exe is launched, a .txt opens in the default text editor, and anything containing :// (like an http:// address) opens in the default browser. Classic game uses are a "visit our website" button or opening a readme. Your program does not wait - the other application runs alongside it and ExecFile returns immediately. If the path contains spaces, wrap it in quote characters yourself, e.g. ExecFile Chr$(34)+"my file.txt"+Chr$(34). Relative paths are resolved against the current directory, like the other file commands. See also: SystemProperty, CommandLine, CurrentDir. |
; ExecFile Example
; ----------------
; ExecFile launches another program (or opens a document with its
; associated program) via the Windows shell.
Print "This example can launch the Windows Notepad."
Print ""
Print "Press and hold Y to launch Notepad, or any other key to skip"
WaitKey
; WaitKey returns as the key goes down, so the chosen key is still held
If KeyDown(21) Then
; Launch Notepad - wrap paths in Chr$(34) quotes if they have spaces
ExecFile "notepad.exe"
Print "Launched notepad.exe"
Else
Print "Skipped launching Notepad."
EndIf
Print ""
Print "Press any key to close the example"
WaitKey
End