[API]
GetCommandLineW
PathGetArgsA
PathGetArgsW
RtlMoveMemory

[CODE]
Public Function GetStrippedCommandLine() As String
  #If InIDE Then
    GetStrippedCommandLine = Command
    #Else
    Dim xLong1 As Long
    Dim xLong2 As Long
    
    If IsUnicode Then
      xLong1 = GetCommandLineW
      If Not xLong1 = 0& Then
        Call RtlMoveMemory(ByVal VarPtr(xLong2), ByVal xLong1, 2&)
        If xLong2 = 34& Then
          GoTo ManualStrip
          Else
          xLong2 = PathGetArgsW(xLong1)
          If Not xLong2 = 0& Then GetStrippedCommandLine = PeekS(xLong2)
          End If
        End If
      Else
      xLong1 = GetCommandLineA
      If Not xLong1 = 0& Then
        Call RtlMoveMemory(ByVal VarPtr(xLong2), ByVal xLong1, 1&)
        If xLong2 = 34& Then
ManualStrip:
          GetStrippedCommandLine = PeekS(xLong1)
          'Stop
          xLong2 = InStr(2&, GetStrippedCommandLine, Chr(34))
          If xLong2 = 0& Then
            GetStrippedCommandLine = ""
            Else
            GetStrippedCommandLine = Trim(Mid(GetStrippedCommandLine, xLong2 + 1&))
            End If
          Else
          xLong2 = PathGetArgsA(xLong1)
          If Not xLong2 = 0& Then GetStrippedCommandLine = PeekS(xLong2)
          End If
        End If
      End If
    #End If
  End Function
