How to use windows "query user" with a username that has a whitespace?

1k Views Asked by At

We can use query user username to get Windows user session information.

For instance, query user user1 or query user user_1 returns with appropriate user information and I can see its status, whether it is connected or disconnected.

My issue is that I cannot do this query for a user 1. I tried query user "user 1", but I get an invalid parameter(s) error.

At first I though the issue might be double quotes, but then I tried query user "user_1" and it worked. It must be the space in the username.

Is there a way to query for users with whitespaces in them?

1

There are 1 best solutions below

1
On

I have just found another command for this quser. You can find more information here.

Using this command quser "user 1" works.