0

I'm trying to create a .bat file to make some tasks easier but i'm having troubles to redirect the Console output of my application (written in C#) to the console which execute my bat file.

In my program I just do :

Console.Writeline("some text");

Here is my bat file :

@echo

    start "" "Myapp.exe" "-t" "-n" 2> NUL


    pause

When I launch the bat file it just displays my command and "pause" but doesn't want to write all my lines.

Why ?

Thank you :)

user2088807
  • 1,378
  • 2
  • 25
  • 47

2 Answers2

1

Start command will execute your app in new console window. Probably you want to have your bat file like this

@echo

Myapp.exe -t -n 2> NUL

pause
Ation
  • 731
  • 7
  • 16
  • This seems better (the console wait for my program to finish his task to display "pause", but still doesn't display any of my WriteLine – user2088807 Oct 19 '14 at 14:56
  • Is your output displayed, when you run your app from console manually? – Ation Oct 19 '14 at 15:08
0

This sounds like it could be related to Output Console.WriteLine from WPF Windows Applications to actual console.

Try start /b /wait myapp.exe -t -n 2>nul and see if that gives the output you want.

Community
  • 1
  • 1
SomethingDark
  • 13,229
  • 5
  • 50
  • 55