I am coding a batch file where WMIC command gives an output which is written to a temp file
WMIC /node:%%A Volume get systemname,caption,freespace,capacity > temp.txt
Temp file is generated but its encoding is UCS-2 Little Endian.
So, when I am trying to read the text file using for loop,
for /f "tokens=1" %%B in (temp.txt) do (
echo %%B
)
This doesnot displays any output because of its encoding format.
Once I convert this Temp.txt to UTF-8/ANSI format the for loop reads the Temp file.
Can I know how can I get the output of WMIC command in UTF-8/ANSI or if not how can I convert UCS-2 Little Endian to UTF-8/ANSI
Regards
You can filter the output of the wmic to convert the file
Or you can convert the file with the
type
commandOr you can directly retrieve the information in the
for
loop