windows - Is there a way to check for redirection inside a batch file? -


If we have a batch file that redirects to a log like this:

C: \ test \ example.bat> C: \ tasting \ example.log

There is no way within the batch file to determine whether a logout file has standard output redirects?

Actually the batch file I need three arguments with it. When the argument is left out, the batch file prints an example of an example, such as regular doss commands, and 'pauses' throws out So that the instructions can be read. Although the batch is called without any argument and it is being logged, then the batch file will always sit there for the key to break a break but will not show anything on the screen.

Normally it will not be a problem at all, although I am trying to make this stupid proof because I will not be able to implement the batch file in other script / scheduled works.

At this point it seems that I have to stop using it altogether, but I was hoping for the solution where I had not to. Thank you for the help.

I have no way to use this only batch and standard commands. However, there are such things that can be used from other languages ​​such as original C or C # programs, if you have enough .bat to include other .exe is important.

  • Here's a stealth approach. This batch file creates a .com file, and it asks to check stdout handles:

  • It tells you how to do it from C #, if you want to write a simple C # helper program: From this I think that it should be possible with powerhall, but I did not try.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -