Page 1 of 1

Posted: Fri Jun 15, 2001 8:23 pm
by BackupUser
Restored from previous forum. Originally posted by Paul.

Does PureBasic have a way to retrieve variables passed to it via command line??

example: file.exe /var1/var2
Then inside file.exe it is able to extract a=var1, b=var2

Posted: Sat Jun 16, 2001 4:57 am
by BackupUser
Restored from previous forum. Originally posted by Mr.Skunk.

Here is an example to do it :

;
; Command Line Example
;
; It will give you the commande line plus the path
; from where your pogram was launched.
;
; Compile It to have acces to the command line and have fun with it


InitWindow(0)



cmd.l=GetCommandLine_() ; the API call to retrieve a pointer to the command line


#WindowWidth = 600
#WindowHeight = 345

If OpenWindow(0, 10, 120, #WindowWidth, #WindowHeight,#PB_Window_SystemMenu, "Command line example")

DrawingOutput(WindowId())
Locate (40,40):DrawText(peeks(cmd))
Stopdrawing()

Repeat
EventID.l = WaitWindowEvent()


Until EventID = #PB_EventCloseWindow

EndIf

End


Mr Skunk