How to Read the Windows Registry From the Command Line With reg query: Safe, Look-Only Examples

Terminal window with a prompt symbol and a magnifier over a small branching tree diagram
Terminal window with a prompt symbol and a magnifier over a small branching tree diagram

Last reviewed: November 25, 2026. The reg query command examples here were compared with Microsoft documentation. None was run on a real PC, and the top picture is an illustration.

The reg query command is a built-in Windows tool that lists registry keys, value names and value data from a Command Prompt window. This guide uses it only as a reader. You will learn the syntax, run safe look-only examples, understand the output types and error messages, and save results to a text file. If you are new to the registry, start with our registry explained: hives, keys and values overview. Many other articles on PC repair guides explain when a registry question is worth checking and when it is not.

Before you change anything

This article is look-only. The commands below read the registry and do not write to it. If a later step on any site asks you to change a value, first back up the key you plan to touch. The backup route is explained in the backup section below. Creating a Windows restore point is a sensible second layer before any change.

Quick answer

Quick answer

  • reg query lists registry subkeys, value names and data from the command line. The forms in this guide only read.
  • Open Command Prompt or Windows Terminal, then type the command with the key path. Menu names can differ between Windows builds.
  • Use /v for one value, /f to search, /s to include subkeys, and /reg:32 or /reg:64 to choose the registry view.
  • Redirect the output with a greater-than sign to a text file when you want a record. Do not add write commands to the same line.
  • Messages such as the registry key or value not being found, or access being denied, describe what the read returned. They are not repair instructions.

In this guide

What reg query does

Microsoft describes reg query as a command that returns a list of the next tier of subkeys and entries under a specified subkey in the registry. In plain words, you name a key, and the command prints what sits directly under it. Add switches and it can print values, search names and data, or walk through every level below the key.

The registry is a database of settings that Windows and installed programs read. It is organised as hives, keys, subkeys and values. A value has a name, a type and data. Our overview covers those terms in more detail, so this guide uses them without re-explaining every one.

Why read before you change

Reading first gives you a record of what is there. A written record is useful when you later compare an old setting with a new one, when you talk through a problem with a person who helps you, or when you decide that a change is not needed at all. Many registry questions end with no change once the reading is done.

Reading is also the safest first habit. The commands in this guide never create, edit or delete a key or a value. They only print what is already there. The sections below explain each switch and what the output can look like.

Open Command Prompt or Windows Terminal

You can run reg query from Command Prompt or from Windows Terminal. Both are normal applications and do not need a special Windows edition. The exact menu names can differ between Windows 10 and Windows 11 and between builds, so the steps below are a general route rather than an exact click path.

Windows 11

  1. Open Start and type cmd or Command Prompt.
  2. Select Command Prompt from the results. Windows Terminal can also open a Command Prompt tab.
  3. Check the prompt shows a path such as C: followed by a greater-than sign, which means the window is ready.

You should see: a black or dark window with a blinking cursor after a path prompt.

If this does not help: open Windows Terminal from Start and choose the Command Prompt profile from the tab menu, if your build offers it.

Windows 10

On Windows 10 the search box on the taskbar can find Command Prompt in the same way. Choose Command Prompt from the list and wait for the prompt to appear. The reg query command is the same in both versions, so the syntax in the next section applies to either one.

Do you need administrator rights?

For most reads of your own user settings, the registry key under HKCU, you should not need an elevated window. We could not confirm this specific point on a Microsoft page, so treat it as a hint rather than a rule. Some keys under HKLM can also be read from a standard account, but permissions set by an administrator or a policy can block a read. When that happens you will see an access message, which is covered in the errors section.

The reg query command syntax

Microsoft Learn gives this syntax for reg query. Only the key name is required. If the key path contains a space, such as Control Panel, put the whole path in double quotes. Everything in square brackets is optional, and the braces with a vertical bar mean choose one of two switches.

reg query <keyname> [{/v <valuename> | /ve}] [/s] [/se <separator>] [/f <data>] [{/k | /d}] [/c] [/e] [/t <Type>] [/z] [/reg:32] [/reg:64]

Switches in plain words

The table below explains each switch in short words. The descriptions follow the Microsoft Learn parameter list. If a switch name in your Windows build behaves differently, check the page and the built-in help that appears when you type reg query /?.

SwitchWhat it doesNotes for a safe read
keynameThe full path of the subkey. It must start with a valid root such as HKLM, HKCU, HKCR, HKU or HKCC.Put the path in quotes if it contains a space.
/v valuenameReturns one named value under the key. If you leave it out, every value name is returned.Useful when you know the name you want.
/veReturns the default value, the one with an empty name.Use it on its own, not with /v.
/sReturns subkeys and value names recursively, all the way down.Output can be long, so save it to a file.
/f dataSearches for the text you give. Without it, a wildcard is used.Use double quotes if the text has a space.
/k and /d/k searches key names only and must be used with /f. /d searches data only.Narrow a search to reduce noise.
/c and /e/c makes the search case sensitive. /e returns exact matches only.Default searches are not case sensitive and return all matches.
/t TypeLimits a search to a registry type such as REG_SZ or REG_DWORD.Types are listed in the output section.
/reg:32 and /reg:64Chooses the 32-bit or 64-bit registry view for the key.Explained in the examples below.

Combining switches

Microsoft Learn notes that /k must be used with /f, and that a remote computer needs a different root form. This guide covers only the local computer. A search with no /f and no /k is simply a listing, which is the safest form to start with.

Safe look-only examples

Each example below is a read. Type the command, press Enter, and read what comes back. Key paths in the examples use the standard names. If a key or value does not exist on your PC, you will see a not-found message. That is a normal result, not a fault in the command.

Read one value

Use /v when you know the value name. The example reads the wallpaper value under the current user desktop settings.

reg query "HKCU\Control Panel\Desktop" /v Wallpaper

You should see: the key path on one line, then the value name, its type and its data on the next line.

If this does not help: the value may not exist under that key on your PC. Try the list form in the next example to see the names that are there.

List a key

Leaving out /v returns every value name directly under the key. This is the best first step when you are not sure of a name.

reg query "HKCU\Control Panel\Desktop"

You should see: a list of value names, each with its type and data, and sometimes a short list of subkeys below the key path.

Search with /f

Use /f to search names and data for a word. The example below searches under the current user software settings for key names that contain the word Run. The /k switch limits the search to key names.

reg query HKCU\Software\Microsoft\Windows\CurrentVersion /f Run /k

You should see: only the key paths whose names contain Run. Each match is printed on its own line, so the result is easy to scan.

Recursive read with /s

Adding /s walks through subkeys as well. Use it with a narrow search, because a recursive read of a large key returns a lot of text.

reg query "HKCU\Control Panel" /s /f Wallpaper

You should see: every match for the word Wallpaper, with the key it came from printed above each match. A short list is a good sign that the search did what you asked.

Read the startup key

Many programs record a startup entry under a Run key. You can read the machine-wide Run key with a plain list. Remember that reading a startup entry does not tell you whether the program it names is safe. For that, see our guides on registry startup entries and Run keys and on Autoruns for a safe startup check.

reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

You should see: a list of entries, each with a name and the command line it starts. Some PCs show no entries here, which is also a normal result.

32-bit and 64-bit views

On a 64-bit Windows PC some keys have a 32-bit view as well. The /reg:32 and /reg:64 switches let you choose which view the read uses. The example reads the same value in both views, so you can compare them. Our guide to 32-bit and 64-bit registry views explains why the two results can differ.

reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion /v ProgramFilesDir /reg:32
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion /v ProgramFilesDir /reg:64

You should see: two results with the same value name. On many PCs the two data values match, but they can differ on some systems. That difference is what the view switch is for.

If this does not help: if the value is missing from one view, the not-found message appears for that view only. The result is still a read, not a sign that anything is broken.

Example table: goal, command and result

The table gathers the reads in one place. Use it as a quick reference when you are choosing a command. Each command is a read.

GoalCommandWhat you should see
Read one named valuereg query "HKCU\Control Panel\Desktop" /v WallpaperThe value name, its type and its data on one line
List every value under a keyreg query "HKCU\Control Panel\Desktop"All value names with types and data, then any subkeys
Find key names that contain a wordreg query HKCU\Software\Microsoft\Windows\CurrentVersion /f Run /kOnly the key paths that match
Search names and data recursivelyreg query "HKCU\Control Panel" /s /f WallpaperEach match with the key it came from
Compare the 32-bit view with the 64-bit viewreg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion /v ProgramFilesDir /reg:32The same value name read from the chosen view
Keep a record in a filereg query "HKCU\Control Panel\Desktop" > "%USERPROFILE%\Desktop\desktop-read.txt"No output on screen; a text file on the desktop

Reading the output and data types

Each value line in reg query output has three parts: the name, the type and the data. The type tells you how to read the data. Microsoft Learn lists the types that reg query can search for, including REG_SZ, REG_MULTI_SZ, REG_EXPAND_SZ, REG_DWORD, REG_BINARY and REG_NONE. The table below explains the types you will meet most often and how to read each one.

TypeWhat it holdsHow to read it
REG_SZA plain text stringRead the data as ordinary text, shown in full on the line
REG_DWORDA single 32-bit numberThe number is written in hexadecimal in many outputs; we could not confirm the display format on a Microsoft page
REG_EXPAND_SZText that can include environment variable namesThe name between percent signs stands for a folder or setting that Windows fills in when a program runs
REG_BINARYRaw bytes, shown as hexadecimal pairsRead it as a block of data, not as a word; a value like this rarely needs to be read by hand
REG_MULTI_SZA list of several text stringsEach entry in the list is one line of text; the /se switch sets the separator used when searching

When you see a type you do not know, do not guess its meaning. Look up the value name in our registry overview or on a Microsoft page, and treat the data as information rather than as an instruction to change anything.

A note on data that looks unusual

Some values hold long paths, file names or numbers that mean nothing without context. A long REG_BINARY line is common for settings that a program keeps for itself. The reading goal here is to record what is there, not to decide what it should be. For a broader look at which values are worth a second look, our guide on registry problems: symptoms and causes explains why most registry values are normal.

Error messages and what they mean

A read can end with a message instead of data. Both common messages describe what the read found. Neither is a repair instruction, and neither means the registry is damaged by itself.

The system was unable to find the specified registry key or value

This message means the key path or the value name you typed does not exist on this PC in the view you asked for. The usual causes are a typing mistake, a key that a program never created on this PC, or a value that sits in the other 32-bit or 64-bit view. We could not confirm the exact wording of this message on a Microsoft page, so the text on your screen may differ slightly by Windows build.

What to do: check the spelling, try the list form without /v to see what is there, and try the other /reg view. If a value that should exist is missing after a program update, a broader look at the registry is useful. Our guide on registry editing disabled by an administrator covers another common reason some reads or edits are blocked.

Access is denied

This message means Windows will not let this account read the key. Permissions are set on the key itself, and the reason can be a policy, an administrator setting or a key owned by another account. Microsoft does not list every case on the reg query page, so we cannot confirm the cause for your PC.

What to do: do not try to force access by changing permissions. Permission questions are a separate topic, and our guide on fixing registry permission errors covers them in a careful way. If the key is managed by a policy, a read may be blocked on purpose, as described in our note on Group Policy versus registry settings.

Good to know

An access message on a read does not mean the command is broken. It means the key is not open to this account. Writing down the exact path and the message is a useful record for a person who can review the permission.

Error text in a different form

Some errors come from Windows itself rather than from the key you typed. If you see a message about a configuration database or about a registry hive that will not open, the problem is wider than one read. Our guide on the configuration registry database corrupt error explains that case, and it is not something reg query can fix.

Saving output to a text file

A text file is the simplest record of a read. The greater-than sign sends the output to a file instead of the screen. The file is created on the first run and overwritten on the next run to the same name, so choose a new name each time you want to keep two results.

reg query "HKCU\Control Panel\Desktop" > "%USERPROFILE%\Desktop\desktop-read.txt"

You should see: nothing printed in the window. Open the text file on the desktop and find the same lines you would have seen on screen.

If this does not help: if the file is empty or missing the lines you expected, the read may have returned a message instead of data. Run the same command without the greater-than part to see what it says on screen.

Before you change anything

Saving a read to a file changes a file, not the registry. Keep the record in a safe place and do not paste registry text into a program that might run it. Only use this file as a reference.

Backups and the commands this guide never uses

Reg query reads. A backup is a separate step, and it is the one that comes before any change. Microsoft Learn describes reg export as a command that copies the specified subkeys, entries and values of the local computer into a file for transfer to other servers. Use it only as a backup route, and follow our back up the registry before changes guide for the full steps. This article does not run reg export.

Before you change anything

This article never uses reg add, reg delete or reg import. Those commands write to the registry. They are not part of any step here, and a read does not need them. If a page you are reading asks you to run one of them, stop, back up the key first, and check the steps with a person who knows your PC.

Two of the most common problems that send people toward changes are an import that does not finish and a file that Windows will not run. Our guides on cannot import a reg file and on whether a reg file is safe to run explain those cases. Reading a key with reg query does not require either of them.

A PowerShell comparison

PowerShell can also read the registry. The cmdlet Get-ItemProperty is the closest match to a read-only reg query. Microsoft Learn describes it as a command that gets the properties of a specified item, and it notes that you can use it to view registry entries and their values. The page describes the -Path and -Name parameters, which are used in the example below.

Get-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name Wallpaper

You should see: the value and its name as PowerShell output, which is shaped differently from reg query output but holds the same information.

Microsoft Learn describes Get-ItemProperty as a read command. It does not say that the cmdlet changes anything, and the cmdlets that change values, such as Set-ItemProperty and Remove-ItemProperty, are separate commands. This guide does not use them.

When to choose which

Use reg query when you want a plain text listing that matches the syntax in this guide. Use Get-ItemProperty when you already work in PowerShell or want a single property returned as an object. Both approaches are read-only in the forms shown here. Pick the one that you can read back to yourself later.

Choosing the right read

The decision tree below helps you pick the first read. It assumes you want information, not a change. If the answer to every question is no, the read is probably not the right step, and a different guide on the site may be a better fit.

  • Do you know the exact value name?
    • Yes: use /v with the key path, for example reg query "HKCU\Control Panel\Desktop" /v Wallpaper.
    • No: go to the next question.
  • Do you know the key path?
    • Yes: list the key with no /v, and read the names it returns.
    • No: search with /f and /k to find key names that contain a word you remember.
  • Did the read return a not-found message?
    • Yes: check the spelling, then try the other /reg view.
    • No: record the output with the greater-than sign to a file.
  • Did the read return an access message?
    • Yes: stop reading that key and note the path. Do not try to change permissions.
    • No: the read worked, so compare the result with the other guides on this site.

Read first, change never

The route below is the order we suggest for any registry question that comes up. Every step is a read. The last step is a decision, and a decision does not require a registry command.

  1. Write down the question. Name the program, the setting or the symptom, so the search has a target.
  2. Read the key with reg query. Use a list form first, then /v or /f if you need more detail.
  3. Save the output to a file. Keep the record with the date and the command you used.
  4. Compare the record with a reference. Check the value name and type in our registry overview before you decide anything.
  5. Back up before any change. If a decision leads to a change, follow the backup guide first.
  6. Decide, and stop if unsure. If the record does not answer the question, ask a person with more context before you touch anything.

The last two steps are the reason this article is look-only. A read is cheap to repeat. A change is not, so the order matters.

Result card: a clean read

Result card

A clean read has four parts you can check: the command you typed, the key path it returned, the value names and types, and a saved file that matches the screen. If all four line up, the read did what it was supposed to do. If one is missing, go back to the errors section or to the decision tree before you go further.

Next steps

Once you can read a key, the next question is usually what the values mean. Start with the registry overview linked near the top of this guide if the terms still feel unclear. If a command you saw in a read returned a not-found message for a tool, our guide on not recognized as a command explains a different problem with the PATH setting, and it is not a registry read.

Some registry questions are really about settings that a program or an administrator controls. Our guide on the registry editor not opening in Windows 11 covers one common case, and the note on leftover registry entries after uninstalling explains what a program can leave behind.

When a read shows a value you do not recognise, keep the file and check the value name against our guide on malware and registry entries. That guide explains a safe check, and it does not recommend deleting values.

If you want a repair route that is not a registry read, our guide on corrupted registry repair on Windows explains why most people should not start with registry edits, and it covers the backup-first order. To pick a next step from your symptoms, open the Repair Assistant tool on this site.

Frequently asked questions

Reading basics

Is reg query safe to run?

The forms in this guide only read. Microsoft describes reg query as a command that returns subkeys and entries. Running a read does not change them, so it is the safest way to start.

Do I need to be an administrator to run reg query?

Microsoft Learn does not state an administrator requirement on the reg query page, so we cannot confirm one. Some keys can still return an access message, which is a permission matter and is covered in the errors section.

What does the /f switch search for?

The /f switch searches for the text you give, in key names, value names and data. Use /k to search key names only, or /d to search data only. Without /f, the command lists the keys and values you ask for.

Why does a value I expected not show up?

The value may not exist under that key on your PC, or it may sit in the other 32-bit or 64-bit view. Try the list form, then the other /reg switch, before you assume anything is wrong.

Output and saving

What does REG_SZ mean in the output?

REG_SZ is the type for a plain text string. The data after it is ordinary text. Read it as a word or a path, not as a command to run.

Can I save reg query output to a file?

Yes. Add the greater-than sign and a file name at the end of the command. Choose a new name each time, because the same name is overwritten on the next run, and keep the file as a record.

How is reg query different from Get-ItemProperty?

Both read registry values. reg query prints a text listing that follows the syntax in this guide. Get-ItemProperty returns properties in PowerShell, and Microsoft Learn describes it as a read command for registry entries and values.

Should I make a backup before reading the registry?

Reading does not write anything, so a backup is not needed for a read. Before any change, make a backup first, as described in our guide to backing up the registry.

How this guide was checked

The steps and syntax were compared with Microsoft documentation where it exists, including the reg query, reg export and Get-ItemProperty pages listed in the sources. Where a Microsoft page did not confirm a menu path, a message or a claim, the text says so and hedges it. The steps were not run on a real PC, and no testing, lab work or account access was used for this article.

Sources