|
Answer» I have created an Ip/Id identifier for computers, to quickly get ip information etc. What i WANT to do is get the command ipconfig/all to be saved on a .txt file for LATER reading. How do i this?
Here is what i have so far.. @echo off echo Computer Name: %computername%>%computername%.txt echo.>>%computername%.txt echo.>>%computername%.txt cls echo User Name: %username%>>%computername%.txt echo.>>%computername%.txt echo.>>%computername%.txt cls echo Time: %time%>>%computername%.txt echo.>>%computername%.txt echo.>>%computername%.txt cls echo Date: %date%>>%computername%.txt echo.>>%computername%.txt echo.>>%computername%.txt cls IPCONFIG |FIND "IP" > %temp%\TEMPIP.txt FOR /F "tokens=2 delims=:" %%a in (%temp%\TEMPIP.txt) do set IP=%%a del %temp%\TEMPIP.txt set IP=%IP:~1% echo %IP% >%temp%\ip.txt echo The current IP address is %IP%>>%computername%.txt cls << About here i want to add the line for ipconfig/all and then have its information saved as a .txt file? pause
I am currently able to get all the above info saved in a single text file so... Any ANSWERS?ipconfig /all>>file.txt
this is CALLED appending to a file, a single > charachter will clear the file or create the file BLANK, redirecting the output of ipconfig /all to file.txt using a single > charachter will not work as there is multiple lines so use two >> This should do what you are wanting.
@echo off echo Computer Name: %computername%>%computername%.txt echo.>>%computername%.txt echo.>>%computername%.txt cls echo User Name: %username%>>%computername%.txt echo.>>%computername%.txt echo.>>%computername%.txt cls echo Time: %time%>>%computername%.txt echo.>>%computername%.txt echo.>>%computername%.txt cls echo Date: %date%>>%computername%.txt echo.>>%computername%.txt echo.>>%computername%.txt cls IPCONFIG |FIND "IP" > %temp%\TEMPIP.txt FOR /F "tokens=2 delims=:" %%a in (%temp%\TEMPIP.txt) do set IP=%%a del %temp%\TEMPIP.txt set IP=%IP:~1% echo %IP% >%temp%\ip.txt echo The current IP address is %IP%>>%computername%.txt ipconfig /all > %ip%>>%computername%.txt cls pause
|