0

I'm writting Windows account report in Ruby. I have an array with usernames

users_local = [user1, user2, user3]

For every single user I want to execute a cmd command to get more information about every user

system "net user '#{users_local[0]}'"

and now I get

The user name could not be found.

More help is available by typing NET HELPMSG 2221.

When I execute directly system 'user net user1' the command is executing correctly. Any ideas why executing command with variable fails?

0

1 Answer 1

2

Getting rid of the single quotes should do it:

system "net user #{users_local[0]}"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.