Skip to content

Instantly share code, notes, and snippets.

@Linda-chan
Last active February 12, 2026 09:22
Show Gist options
  • Select an option

  • Save Linda-chan/b5d71f338852a5039053848bc62e833b to your computer and use it in GitHub Desktop.

Select an option

Save Linda-chan/b5d71f338852a5039053848bc62e833b to your computer and use it in GitHub Desktop.
#include "windows.bi"
#include "win\shellapi.bi"
'====================================================================
Declare Sub Main()
Declare Sub MyPrint(ByVal Text As String)
Declare Function MyCommand() As String
'====================================================================
Main
'====================================================================
Public Sub Main()
Print "/" & *Cast(ZString Ptr, GetCommandLine()) & "/"
Print "/" & MyCommand() & "/"
End Sub
'====================================================================
Private Function MyCommand() As String
Dim lpCmdLine As ZString Ptr
Dim CmdLine As String
Dim RC As Integer
lpCmdLine = GetCommandLine()
If Len(*lpCmdLine) = 0 Then Return ""
CmdLine = *lpCmdLine
CmdLine = LTrim(CmdLine, Any !" \t\r\n")
If Left(CmdLine, 1) = """" Then
RC = InStr(2, CmdLine, """")
If RC = 0 Then Return ""
RC = RC + 2
Else
RC = InStr(CmdLine, " ")
If RC = 0 Then Return ""
RC = RC + 1
End If
Return Mid(CmdLine, RC)
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment