Skip to content

QUERY Windows Command Guide

The Windows query command is a powerful tool that allows you to retrieve various types of information from your system. You can use it to display details about running processes, services, device drivers, and other system resources. By utilizing different options and parameters, you can customize the output to meet your specific needs. This command provides valuable insights into the inner workings of your Windows operating system, helping you troubleshoot issues and optimize performance.

QUERY Syntax:

Terminal window
dir [drive:][path][filename] [/a[[:]attributes]] [/b] [/c] [/d] [/l] [/n] [/o[[:]sortorder]] [/p] [/q] [/s] [/t[[:]timefield]] [/w] [/x] [/4] [/?]

Options:

OptionDescription
/aDisplays files with specified attributes.
/bUses bare format (no heading information).
/cDisplay the thousand separator in file sizes.
/dSame as wide but files are list sorted by column.
/lUses lowercase.
/nNew long list format where filenames are on the far right.
/oList by files in sorted order.
/pPauses after each screen of information.
/qDisplay the owner of the file.
/sDisplays files in specified directory and all subdirectories.
/tControls which time field displayed or used for sorting.
/wUses wide list format.
/xThis displays the short names generated for non-8dot3 file names.
/4Displays four-digit years.
/?Displays help.

Parameters:

ParameterDescription
drive:Specifies the drive to list.
pathSpecifies the directory to list.
filenameSpecifies the name of the file to list.

QUERY Command Samples:

List All Running Processes

Terminal window
query process

Displays a list of all running processes on the system.

Display User Sessions

Terminal window
query session

Shows information about all active user sessions on the system.

Retrieve Information About Services

Terminal window
query service

Provides details about the services running on the system.

Display CPU Information

Terminal window
query cpu

Retrieves information about the central processing units (CPUs) on the system.

List Available Network Adapters

Terminal window
query nic

Shows a list of all network interfaces available on the system.

Display Memory Usage

Terminal window
query memory

Provides information about the memory usage on the system.

List Available Display Information

Terminal window
query display

Shows details about the display devices connected to the system.

QUERY FAQ:

How do I use query in Windows?

To use the query command in Windows, execute the following command:

Terminal window
query session

What does the query command do in Windows?

The query command in Windows is used to display information about processes, users, sessions, and other system details.

How can I list all processes using the query command in Windows?

You can list all processes using the query command in Windows by running the following command:

Terminal window
query process

How do I display detailed information about a specific user with the query command in Windows?

To display detailed information about a specific user using the query command in Windows, use the following command:

Terminal window
query user username

Can I use the query command to get information about active sessions in Windows?

Yes, you can use the query command to get information about active sessions in Windows by running the following command:

Terminal window
query session

How do I check system uptime using the query command in Windows?

To check the system uptime using the query command in Windows, execute the following command:

Terminal window
query os

Applications of the QUERY Command

  • Retrieve system information
  • Display information about users
  • Check the status of services
  • Verify the existence of a user account
  • List active sessions
  • Get information about groups
  • Display information about disks and volumes