We help IT Professionals succeed at work.

How to shell with the $Command option

Draner asked
I want to prevent users from using an exe because I want my app to be the only one that can use the file. How can I arrange this with the $Command function.


If go.exe is double-clicked in Windows Explore, the file will not run.

If my file shells go.exe/run, I want the file to run.
Watch Question

try this in Form_Load (or Sub Main as the case may be):

Private Sub Form_Load
  If Command$ <> "runit" Then
    MsgBox "CANNOT RUN", vbCritical
    'Do other stuff
  End If
End Sub

then when you shell the prog, use this:

Shell "C:\MyProg\MyProg.exe runit"

hope this helps!

Explore More ContentExplore courses, solutions, and other research materials related to this topic.