I used these lines in a batch file:
@echo off
start cmd /k "wmic csproduct get uuid"
to get the UUID of my computer.
I want to store the result into a text file. Is it possible and how?
This should work
@echo off
start cmd /k "wmic csproduct get uuid > C:\temp\yourfile.txt"
for /f "skip=1delims=" %%a in ('wmic csproduct get uuid') do set "uuid=%%a"&goto gotuuid
:gotuuid
echo "%uuid%"
The skip=1
skips the first wmic
line-output (which contains the literal "UUID"); the variables is set to the contents of the next line and the goto
ensures that just one line is processed.
The output is usually padded with trailing spaces up to a defined length.
Try this:
@Echo Off
For /F "Skip=1 Delims=" %%A In ('WMIC CSProduct Get UUID'
) Do For %%B In (%%A) Do Call :Sub %%A
Exit/B
:Sub
(Echo %*)>MyUUID.txt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.