我正在为我的工作处理这个脚本,但我不能让它在输入上设置用户名和密码,任何想法。
for /f "tokens=*" %%a in (ip.txt) do (
wmic /node:%%a /user: /password: computersystem get Name, Model, totalphysicalmemory /format:list
wmic /node:%%a /user: /password: cpu get Name /format:list
wmic /node:%%a /user: /password: path Win32_VideoController get Name /format:list
wmic /node:%%a /user: /password: os get Caption /format:list
wmic /node:%%a /user: /password: csproduct get identifyingnumber /format:list
wmic /node:%%a /user: /password: desktopmonitor get screenheight, screenwidth /format:list
wmic /node:%%a /user: /password: memorychip get capacity /format:list
)>"%%a.txt"
所以我想要
/user: %user%
/password: %password%
如何将其设置为输入?
答案 0 :(得分:1)
从你如何表达你的问题,这应该有所帮助。
我写这个假设代码片段是批处理文件中的 all 。
@echo off
::put this above the start label
goto input
::put this right above your for statement
:start
::be sure to edit the wmic lines like so:
:: /user:%name% /password:%password%
::also you may want to add something to check the inputs for
::any 'poison characters'
::gets input
:input
set /p name=Enter your user-name:
pause
cls
set /p password=Enter your password:
pause
cls
::takes execution back to the for statement
goto start
答案 1 :(得分:0)
:register
cls
echo account don't exist. please make an account
echo.
echo.
Set usrname=
set /p usrname=Username:
Set passw=
set /p passw=Password:
MKDIR "\path\"
echo %usrname%> \path\username.dll
echo %passw%> \path\password.dll
goto login
:login
cls
:begin
cls
echo Please log in to your account!
set usr=
set /p usr=Username:
if {%usr%}=={} goto :begin
set authenticated=
for /f "tokens=*" %%a in (\path\username.dll) do (
if {%%a}=={%usr%} set authenticated=true
)
if not defined authenticated (echo Invalid Username & goto :begin)
:passwo
set pass=
set /p pass=Enter your password:
if {%pass%}=={} goto :begin
set authenticated=
for /f "tokens=*" %%a in (\path\.password.dll) do (
if {%%a}=={%pass%} set authenticated=true
)
if not defined authenticated (echo Invalid password & goto :begin)
:loggedin