Sign in to follow this  
Followers 0
gespinoza

Use of CmdLine

7 posts in this topic

Greetings Friends...

I am using: $COPIAS = $$CmdLine[1 ]

Since I make the validation when it does not come the information and power to assign a value to the variable $COPIAS?

Thanks for its invaluable aid.


Atte.Gonzalo Espinoza B.Consultor en InformáticaCel. (593-9) 619-4108Guayaquil - Ecuador

Share this post


Link to post
Share on other sites



Greetings.

Excuse was a write error, the commando as I am using it is: $COPIAS = $CmdLine[1 ]

When I execute the program, ex: Script.exe 01

Work in correct form.

But when I do it: Script.exe

without the argument, gives an error me, which is correct.

What I require is to validate that that field comes with value and if the instruction is not asi to send a message of error to the user using: MsgBox


Atte.Gonzalo Espinoza B.Consultor en InformáticaCel. (593-9) 619-4108Guayaquil - Ecuador

Share this post


Link to post
Share on other sites

Greetings friends...

The programs use some variables:

$VAR1 = $CmdLine[1 ]

$VAR2 = $CmdLine[2 ]

$VAR3 = $CmdLine[3 ]

The instruction that you indicate to me I have used it and works when value has not been specified some.

But, like been worth if: $VAR3 = $CmdLine[3 ] comes without value?

Thanks for its invaluable aid


Atte.Gonzalo Espinoza B.Consultor en InformáticaCel. (593-9) 619-4108Guayaquil - Ecuador

Share this post


Link to post
Share on other sites

Hi Gonzalo,

Perhaps this code will work nicely for you:

If $CmdLine[0] < 3 Then
    MsgBox(0x10, 'Error', 'You have specified ' & $CmdLine[0] & ' parameters. 3 are required.')
    Exit
EndIf

$Var1 = $CmdLine[1]
$Var2 = $CmdLine[2]
$Var3 = $CmdLine[3]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0