Command line tool to supply user name and password.


Is there any command line tool available to supply user name and password on destination computer before executing  any command.

For Example:

I will be running : REG.EXE QUERY \\computer_name\HKLM\System\CurrentControlSet\Services /s > result.txt

I'm processing the above commnd in a script. Some servers are skipped because they need different user name and password. If any command line tool is available that can be used to establish the connection (not necessarily secure) with remote computer and then next (REG.EXE) command or available commands.

LVL 35
Nirmal SharmaSolution ArchitectAsked:
Who is Participating?
I think you can use the runas command

runas /user:domain\username "REG.EXE QUERY \\computer_name\HKLM\System\CurrentControlSet\Services /s > result.txt"

let me know if that works

Check out psexec at
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.