TmCookieMonster
TmCookieMonster

Reputation: 61

two inputs on batch

im working on this script for my work, but i cant get it to set a user name and password on input, any ideas.

 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"

so i want the

 /user: %user%
 /password: %password%

how do i set that as an input?

Upvotes: 0

Views: 51

Answers (2)

user5750809
user5750809

Reputation:

: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

Upvotes: 0

Ravkrat
Ravkrat

Reputation: 30

From how you worded your question this should help.

I wrote this assuming that the snippet of code is all that is in the batch file.

@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

Upvotes: 1

Related Questions