How to create a batch file about system info and ip address and domain server etc. _ which will generate a output as txt file
-
You might consider posting this on the the StackExchange forum called *Server Fault*. Either that or actually write batch file (give it a shot), and post your code here. We can help you wrangle the code at that point. – Feb 15 '15 at 20:29
-
You may want to check wmic command - see: https://msdn.microsoft.com/en-us/library/bb742610.aspx and http://stackoverflow.com/questions/15973276/systeminfo-get-computer-system-model-via-cmd-extra-spaces-bug – NoChance Feb 15 '15 at 20:44
1 Answers
You can put whatever Windows commands you want in a batch file and then redirect the output to a text file using >
. E.g., you could create a batch file called test.bat and put the following commands in it:
@echo off
systeminfo
ipconfig /all
Then you could run test.bat from a command prompt as follows:
C:>test >outfile.txt
The output of the batch file, which would consist of the output from the commands you placed in it, would be redirected to a file named outfile.txt by the redirect operator, >
. Note: it can sometimes take awhile for the output of the systeminfo command to complete, so, depending on your system, you may need to give it a minute to complete.
Alternatively, you could add the >outfile.txt
at the end of commands within the batch file itself, though for every instance after the first one you need to use double greater than signs, i.e., >>, to append the output rather than wiping out what was in outfile.txt previously and creating a new version of that text file. E.g., you could have the following in test.bat:
@echo off
systeminfo >outfile.txt
ipconfig /all >>outfile.txt
You would then just use the following at a command prompt:
C:>test

- 171
- 3