By definition Console isn't a stream. There is another stream, Standard Input : many commands accept input at their Standard Input instead of directly from the keyboard. Probably the most familiar example is MORE :. The result may differ for different operating system versions, but in Windows XP I get the following error message:.
COM isn't possible actually it is, by using the CTTY command, but that would redirect all output including Console, and input, including keyboard. You see? What did you get? It looks like CMD. We'll see how we can use this later. Ok, now that we get the idea of this concept of "streams", let's play with it. Copy the following code into Notepad and save it as "test. Asked 12 years, 9 months ago. Active 2 years, 1 month ago. Viewed k times. The idea would be either to execute myjob.
Anyone interested in implementing optional script parameters with default values should have a look at this answer to a question about Windows Bat file optional argument parsing — dbenham.
Add a comment. Active Oldest Votes. Leonardo Puglia Leonardo Puglia 3 3 silver badges 2 2 bronze badges. Would that work with numbered parameters, like I'm using in my example, or only with named variables? Start the batch with: SetLocal and end it with EndLocal This will keep all your 'SETs" to be only valid during the current session, and will not leave vars left around named like "FileName1" or any other variables you set during the run, that could interfere with the next run of the batch file.
Hope this helps. LarryF LarryF 4, 4 4 gold badges 29 29 silver badges 40 40 bronze badges. Thanks for the suggestions.
Just curious Actually, I think this is a throw-back. But, the real reason is, at one time, you had cmd. I think it also makes you look cooler, but I can't confirm that. There is a subtle difference between them, and Raymond Chen had an Old New Thing post about it that I can't find right now Google is not being my friend.
See also this SO Q: stackoverflow. Stanislav Kniazev Stanislav Kniazev 5, 3 3 gold badges 34 34 silver badges 43 43 bronze badges. Late answer, but currently the accepted one is at least suboptimal.
Create a free Team What is Teams? Learn more. How to output batch command to null Ask Question. Asked 9 years, 8 months ago. Active 2 years, 3 months ago. Viewed 29k times. Improve this question. Ben Ben 1 1 gold badge 1 1 silver badge 5 5 bronze badges. It is recommended not to publish both your wireless password and your coordinates Add a comment. Active Oldest Votes. Improve this answer.
0コメント