Very novice on this but how i can combine this 2 lines so writes to a file beside each other
FINDSTR "^%computername%$" < C:\scripts\macadd\log.txt >NUL || ECHO %computername%>>C:\scripts\macadd\log.txt
wmic nicconfig where "ipenabled='true'" get macaddress
thanks in advance
Batch for Mac And Computer name to a file
Moderator: DosItHelp
Re: Batch for Mac And Computer name to a file
Please show us an example of what you want.
Re: Batch for Mac And Computer name to a file
i want the text file to have
computername macaddress
but i will prefer if possible to be write to excel file but if not to a text file will ok for now
Thanks once more
computername macaddress
but i will prefer if possible to be write to excel file but if not to a text file will ok for now
Thanks once more
Re: Batch for Mac And Computer name to a file
One way is to use two statements and get the item you need into a different environment variable in each line.
Those two environment variables can then be echoed into a file on the same line.
Those two environment variables can then be echoed into a file on the same line.
-
- Posts: 233
- Joined: 21 Nov 2010 08:07
- Location: At My Computer
Re: Batch for Mac And Computer name to a file
creyes3 wrote:i want the text file to have
computername macaddress
but i will prefer if possible to be write to excel file but if not to a text file will ok for now
Thanks once more
Late to the party and you did not say if you wanted the mac of your lan or wireless adapter but here is a simple example.
~DP
Code: Select all
@Echo Off
Set Output=%systemdrive%\macadd\log.txt
:: ### COMPUTER NAME:
FOR /F "Tokens=2 Delims==\" %%C In ('WMIc OS Get csname /Value') Do Set CompName=%%C
:: ### MAC ADDRESS OF LAN ADAPTER:
For /F "Tokens=* Skip=1" %%M In ('"WMIc Nicconfig Where IPEnabled=True Get macaddress|FindStr ."') Do Set "MacAddy=%%M"
:: ### OUTPUT:
Echo. Computer Name and Mac Physical Address: %CompName% %MacAddy% >>%Output%