includepath "$/inc/"
% filename "t.exe"
include "rtl32.inc"
include "MinWin.inc"
'% NoConsole
'% TryAttachConsole
include "Console.inc"
include "ParseUtil.inc"
Color 0xf8
cls
Function CommandLineArgs() as string
====================================
sys i=1
string Command, wr, s
Command=GetCommandLine
StepWord Command,i 'step over filepath\file
if ascb=34 then
s=getword Command,i
if ascb=34 then
s=unquote s
else
s=mid Command, sttw
end if
else
skipspace Command,i
s=mid Command,i
end if
return s
end function
function DOS(string s)
======================
string c
static STARTUPINFO infs
static PROCESS_INFORMATION infp
if s then c="cmd.exe /c " else c="cmd.exe "
CreateProcess null,c+s,0,0,0,0,0,0,@infs,@infp
WaitForMultipleObjects 1,@infp.hthread,1,-1
CloseHandle infp.hProcess
CloseHandle infp.hThread
end function
function Console(string ti)
===========================
SetConsoleTitle ti
zstring dt[0x100]
string s=""
'GetCurrentDirectory 0xff, strptr dt
'output GetCommandline() cr cr
do
Color 0xf2
output(dt+chr(2,32))
Color 0xf0
s=ltrim rtrim input
if s
s=lcase s
le=len s
'COMMAND INTERCEPTS
if s="exit" then exit do
'if s="?"
' output "gxo2 <file>" cr
' continue do
'end if
if left (s,3)="cd "
s=ltrim mid s,4
SetCurrentDirectory s
continue do
end if
Color 0xf3
DOS s
end if
end do
end function
Console "OxygenBasic Command Prompt"
FreeConsole