changos Posted January 14, 2009 Posted January 14, 2009 Hi all ! I want to that my application get some parameters at the start time . In short , how to run the application from command line and pass some parameters into it , for example C:\myapplication.exe -s 100 and in myapplication.exe can get those parameters are -s and 100 . Thanks. --------------------------------------------------------------------------------------------------- Nguyen Xuan Truong Email: chunchang.ithut@hotmail.com
FireFox Posted January 14, 2009 Posted January 14, 2009 @changos for run your application with parameters use : ShellExecute("yourapp.ext","parameters") And for create command line parameters in your script use : Func _GetCmdLine($aArgument, $bArgument = '', $CmdDelim = "/") Local $RetCmd = _GetMidleString($CmdLineRaw, $aArgument, ' ') If $RetCmd = '' Then $RetCmd = _GetMidleString($CmdLineRaw, $aArgument, ' ' & $CmdDelim) If $RetCmd = '' Then $RetCmd = _GetMidleString($CmdLineRaw, $aArgument, '$') If $RetCmd = '' Then $RetCmd = _GetMidleString($CmdLineRaw, $aArgument, $bArgument) Return StringStripWS($RetCmd, 3) EndFunc ;==>_GetCmdLine Func _GetMidleString($sString, $sStart, $sEnd, $iCase = -1, $iRetType = 0) Local $iCaseSence = '' If $iCase = -1 Then $iCaseSence = '(?i)' Local $aArray = StringRegExp($sString, '(?s)' & $iCaseSence & $sStart & '(.*?)' & $sEnd, 3) Local $IsArrayCheck = IsArray($aArray) If $IsArrayCheck And $iRetType = 1 Then Return $aArray If $IsArrayCheck And $iRetType = 2 Then Local $iUbound = UBound($aArray) If Not StringInStr($aArray[$iUbound - 1], "Next") Then Return $aArray[$iUbound - 1] If ($iUbound - 2) >= 0 Then Return $aArray[$iUbound - 2] Return $aArray[$iUbound - 1] EndIf If $IsArrayCheck Then Return $aArray[0] Return SetError(1, 0, "") EndFunc ;==>_GetMidleString Cheers, FireFox.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now