Как передать переменную в запрос WMI, запущенный в командном файле?

2478
Dianda

Я хочу запустить следующее в командном файле и предложить пользователю ввести «NewUserID», а затем вставить его в качестве переменной. Можно ли это сделать с помощью WMI?

wmic useraccount where name='user'call rename name='NewUserID' 
0

1 ответ на вопрос

0
TheSavo

why not prompt the user with set /p I did this with some HP machines to read the AssetTag field fom the BIOS.

You should be able to replace newuserid with your variable.

Test

Start a bat or cmd file.

@echo off set /p _MYVARIABLE= echo %_MYVARIABLE% pause 

I found a reference to wmic and they discuss variables with this command. Link

Я попытался и получил следующее сообщение об ошибке: Код: = 0x80041017 Описание = Неверный запрос, Facility = WMI Dianda 11 лет назад 0