How do you get the arguments in C#, when you send in pipelined arguments?
like
dir /S /B | someprogram.exe
How will someprogram be able to get the values returned from dir /S /B ?
How do you get the arguments in C#, when you send in pipelined arguments?
like
dir /S /B | someprogram.exe
How will someprogram be able to get the values returned from dir /S /B ?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Jan MontanoRank #1,295 · 1.3K reputationPosted Jun 10, 2008, 5:38 PM EDT
In a console program...
class Program
{
static void Main(string[] args)
{
//args.Length
}
}
you read the arguments by traversing the args array in Program.cs. where args.Length is the number of arguments passed in you exe.
In a windows app
static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
//static void Main()
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
you just change the parameterless Main method into a parametered one specifying a string array. Then read it just the same as you read it in the console program.
jesus3 reputationPosted Jun 10, 2008, 5:59 PM EDT
I know how to get the command line arguments I just don't know how to get the pipelined arguments.