hey i'm trying to make console app with basic commands like copy,move the problem is that i cant get my code right
the command suppose to be like this:

= copy to
file directory>the copied file
im trying to split the : file directory, > , the copied file
to string or perhaps if there is an easier way to do so
thanks for the help:)

Edited by gal7

4 Years
Discussion Span
Last Post by lolafuertes

So basically, you read a console command and need to parse it?
The command read, should be in some string and you can use the split function to obtain an array of strings between the designed separators.

copy ttt.txt>yyy.ddd

You read this into the inputCommandString.

Tehn you can obtain the order and the parameters usint the split function:

dim orderAndParameters as string() = inputCommandString.Split(" "c)

Then you can verify the order and parameters by using a select - case structure:

select orderAnParameters.Length
case 0 ' no order nor parameters
 ' send a message? or ignore it?
case 1 ' only an order
 ' verify if the order is one of the possible orders without parameters or show the order usage in case of wrong number of parameters
 case 2 ' the order and one parameter
 case else ' not defined.
 end select

Also a regex can help to analyze if the command and parameters structure is right.

Hope this helps


Thank You for you'r help:)
I found another way to do so by using the command split.


Please, be so kind to share your howto here, and then mark the thread as solved.
Thanks in advance.

Edited by lolafuertes

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.