🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.winforms.general
Article #25

Running a batch in the windows shell with parameters.

#25
From: J.A. Smit
Date: Tue, 08 Mar 2005 00:26
25 lines
1745 bytes
Hi,
well my subject covers the question completely.

How do I run a batch WITH parameters from my C# Windows application.
I can run only the batch without a hitch but when I try to give some
parameters it comes back with an unhandled exception.

The code I use:

private void button1_Click(object sender, System.EventArgs e)
  {
   if ((textBox1.Text!="")&&(textBox2.Text!=""))
   {Process myProcess = new Process();
    string Path="C:\x5cProgram Files\x5cVPN";
    string UserInfo= textBox1.Text+" "+textBox2.Text;
    myProcess.StartInfo.FileName = Path + "\x5cVPN.bat " + UserInfo;
    myProcess.Start();
   }

So I type in two parameters (username+ password) and click a button to start
my batch (witch runs rasdial and creates mappings).
Any tips would be greatly appreciated..

regards
J.A. Smit
Technical Details
Message-ID: <422cf130@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efeb1,27affd2019062ee,start
X-Google-Attributes: gid1efeb1,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "J.A. Smit" <alex.zoem@wanadoo.nl>
From: "J.A. Smit" <alex.zoem@wanadoo.nl>
Newsgroups: borland.public.csharpbuilder.winforms.general
Subject: Running a batch in the windows shell with parameters.
Date: Tue, 8 Mar 2005 01:26:25 +0100
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 212.129.129.221
Message-ID: <422cf130@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1110241584 212.129.129.221 (7 Mar 2005 16:26:24 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail