Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need some help please

Status
Not open for further replies.

leewat

Programmer
Dec 31, 2010
2
US
Hi all....not sure if this is even in the correct place or not - if not KINDLY guide me in the right direction and I will get it there.

I would like to use WMIC in a batch file or vbscript. I need to be able to enter a computer name or ip address and return the user name. The following works perfectly from a command prompt:

WMIC /NODE: <computername> COMPUTERSYSTEM GET USERNAME

As you can see, that is a lot of typing each time. I have written the following batch file:

@echo off
set /p usrinput = Enter computer name or ip address -^>

WMIC /NODE: %usrinput% COMPUTERSYSTEM GET USERNAME

And it will not work. Does anyone have any ideas??

Thanks in advance for your patience with a newbie..
 
Dummy me.....got it...sorry to bother you all.

solution was (for anyone that cares)

set /p usrinput=Enter computer name or ip address: %=%
cmd.exe /c wmic /node:%input% computersystem get username
pause


forgot the cmd.exe and had some "extra spaces"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top