Creating a simple command line console app in Visual Studio 2019 (2 Viewers)

Isaac

Lifelong Learner
Local time
Today, 02:24
Joined
Mar 14, 2017
Messages
8,777
Hello all,
I am trying to create a console app in visual studio 2019, which will eventually become an .exe that can be ran using command line programming, i.e., someone can open the command prompt and put in a command that contains the path to the exe with 2 different parameters.

I already have the successful .net code written but it's in the form of an SSIS script task.

This is in VB.net only.

I'm having some trouble understanding how to create a console app which can be truly automated via command line and take input param's.

I see various tutorials from MS but I am not readily finding a good one that focuses on the user being able to command line run the program using input switches - rather, they prompt the user at run-time for input, which I don't want to do, as I want it to be able to be automated.

Does anyone know a tutorial or site or set of instructions that may get me to the end point rather quickly? I already have working .net code for the task at hand, just need to figure out how to turn it into an exe that someone can run with command line something like

pathtoexe -filepath thefilepath -chunksize 600
 

Isaac

Lifelong Learner
Local time
Today, 02:24
Joined
Mar 14, 2017
Messages
8,777
Ok I kinda figured it out thanks to some web pages - you just assume the input args() is a string array, space delimited, meaning string array for use on the inside and space-delimited for 'how to use' on the outside.

pathtoexe "firstargvalue" "secondargvalue"

and Bazinga! that's it! Cool stuff, having fun on this one, as fun goes..
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 19:24
Joined
Jan 20, 2009
Messages
12,852
you just assume the input args() is a string array, space delimited
That doesn't sound right. You should be able to pass numeric arguments.

I've not included parameters in a console app before but I expect they would be individually declared on Main().
 

Isaac

Lifelong Learner
Local time
Today, 02:24
Joined
Mar 14, 2017
Messages
8,777
I mean the args() is a string array inside the .net

Got it working!

They're not individually declared, they just come in from the outside as args() string array on the inside
 

Users who are viewing this thread

Top Bottom