I have a batch file script I am trying to create to obtain some pretty basic info on the computers at my job site. However, I am having severe issues with encoding. WMIC and IPCONFIG put out different encodings, and as such, it is causing me to obtain garbled results when the commands execute. Thus far, I have:
@echo off
if exist "C:\%computername%-info.txt" (
echo Your computer information is already published! Skipping
) else (
ipconfig /all > "C:\%computername%-info.txt"
wmic bios get serialnumber >> "C:\%computername%-info.txt"
)
pause
The results are...weird. I don't know what the encoded output is for each of these tools, and I still have more to add...does anyone know a fix? I don't know too much about codepages (chcp) but I've tried several and still get the same garbled results.