RE: C# console application executing command line commands?

  • From: "DaShiell, Jude T. CIV NAVAIR 1490, 1, 26" <jude.dashiell@xxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Mon, 9 Aug 2010 08:00:19 -0400

Your mistake was ever letting visual studio even know about that batch
file.  Batch files properly belong to the operating system and with the
operating system and nowhere else.

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jacob Kruger
Sent: Saturday, August 07, 2010 17:08
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: C# console application executing command line commands?

Oh yes, and one other issue that am not too sure where/why it arose was
that 
the batch file I had created as a text file, and then renamed within
VS.Net 
2008 kept on giving me an execution error along the lines of:
--n echo is not recognized as an operable....

error message, but I then recreated it using notepad, retyped commands,
and 
pasted file into VS.Net solution explorer and problem went away, so I
assume 
it was something like either just a \n or \r character at the beginning
of 
the first line or something that the command line application (cmd.exe)
was 
picking up, and complaining about, and the only other time have really
seen 
something similar to this was when I created an HTML file in VS.Net, but

then renamed it to .php and tried uploading it to a linux box, since if
you 
plan to use <?php session_start... it really needs to be the very first 
thing in a .php file, but anyway...

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

----- Original Message ----- 
From: "Jacob Kruger" <jacobk@xxxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Saturday, August 07, 2010 10:54 PM
Subject: Re: C# console application executing command line commands?


> Ok, FWIW, seems simplest trick is to use the
System.Diagnostics.Process to 
> in fact execute a batch file:
>
>
> System.Diagnostics.Process proc = new System.Diagnostics.Process();
>
> proc.EnableRaisingEvents = false;
>
> proc.StartInfo.FileName = stAppPath + "playlist.bat";
>
> proc.StartInfo.Arguments = fils[I].Substring(2, (fils[I].Length - 2));
>
> proc.Start();
>
> proc.WaitForExit();
>
>
>
> fils[] string array is something am populating using 
> System.IO.Directory.GetFiles(), and stAppPath is assigned a value from
>
> System.IO.Directory.GetCurrentDirectory() fwiw;
>
>
> Only real issue now is that if the argument strings have spaces in
them, 
> they get seen as multiple arguments, so unless can confirm if can do a

> form of search/replace within batch file, I'll do something like
specify 
> up to around 5-10 of them in case:
> echo %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 > zFile.txt
>
> And that should work around the spacing issue, but let's see...might
just 
> go over to actual windows app, and stream playlist file contents
myself 
> from within code, but anyway...
>
> Other thing remembered is that within the actual batch file/command
line 
> instance while > will redirect to a newly created/replaced file, >>
will 
> in fact append to an existing file.
>
> You can also easily enough use System.Console.WriteLine to output
status 
> messages, but jaws, for example doesn't read them to me automatically.
>
> Stay well
>
> Jacob Kruger
> Blind Biker
> Skype: BlindZA
> '...fate had broken his body, but not his spirit...'
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus 
> signature database 5348 (20100806) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
> __________
> View the list's information and change your settings at 
> //www.freelists.org/list/programmingblind
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus 
> signature database 5348 (20100806) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
> 


__________ Information from ESET NOD32 Antivirus, version of virus
signature database 5348 (20100806) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

Other related posts: