Skip to content

Instantly share code, notes, and snippets.

@Linda-chan Linda-chan/MyCommand.BAS
Last active Dec 1, 2019

Embed
What would you like to do?
#include "windows.bi"
#include "win\shellapi.bi"
'====================================================================
Private Function MyCommand() As String
Dim lpCmdLine As LPSTR
Dim CmdLine As String
Dim RC As Integer
lpCmdLine = GetCommandLine()
If lstrlen(lpCmdLine) = 0 Then
MyCommand = ""
Exit Function
Else
CmdLine = String(lstrlen(lpCmdLine) + 1, 0)
lstrcpy CmdLine, lpCmdLine
End If
CmdLine = LTrim(CmdLine, Any !" \t\r\n")
If Left(CmdLine, 1) = """" Then
RC = InStr(2, CmdLine, """")
If RC = 0 Then
MyCommand = ""
Exit Function
End If
RC = RC + 2
Else
RC = InStr(CmdLine, " ")
If RC = 0 Then
MyCommand = ""
Exit Function
End If
RC = RC + 1
End If
MyCommand = Mid(CmdLine, RC)
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.