Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Command Prompt cannot generally reveal the complete Microsoft Office product key. For most desktop installations, Microsoft’s licensing script shows the activation state and only the last five characters of the installed key.
That is useful for identifying which Office license is installed, but it is not a way to recover a lost 25-character key. Microsoft 365 subscriptions and Office licenses redeemed to a Microsoft account may not have a recoverable key at all.
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
Microsoft Office Home 2024 | One time purchase, 1 Device | Windows 10/11, Mac - Key Card | Buy on Amazon |
Check an Office installation with Command Prompt
The built-in ospp.vbs script is the usual command-line method for checking desktop editions of Microsoft Office, including many Click-to-Run installations of Office 2010, 2013, 2016, 2019, 2021, and related editions.
1. Open Command Prompt as administrator
- Open Start and type Command Prompt.
- Right-click Command Prompt and select Run as administrator.
- Select Yes if User Account Control asks for permission.
2. Run the licensing-status command
Try the Office 16 folder first. This folder name is also used by several newer Office versions.
#1 Best Overall
- One-time purchase for 1 PC
- Classic desktop versions of Word, Excel, PowerPoint, and OneNote
- To install and use on one PC or Mac
cd /d "%ProgramFiles%Microsoft OfficeOffice16"
cscript ospp.vbs /dstatus
A successful result includes information similar to:
LICENSE NAME: Office 16, Office16ProPlusVL_KMS_Client edition
LICENSE DESCRIPTION: Office 16, TIMEBASED_KMSCLIENT channel
LICENSE STATUS: ---LICENSED---
Last 5 characters of installed product key: ABCDE
The important lines are:
- LICENSE STATUS tells you whether that Office license is activated.
- LICENSE NAME and LICENSE DESCRIPTION identify the edition and licensing channel.
- Last 5 characters of installed product key identifies the installed key, but does not expose the complete key.
If you only want the key-identification line, run:
cscript ospp.vbs /dstatus | findstr /i "Last 5"
If the command says the file cannot be found
The most common reason is that Office is installed in the 32-bit Program Files directory while Windows is 64-bit. Try these locations in turn.
Office installed under Program Files (x86)
cd /d "%ProgramFiles(x86)%Microsoft OfficeOffice16"
cscript ospp.vbs /dstatus
Older Office versions
Older releases may use a different folder number:
cd /d "%ProgramFiles%Microsoft OfficeOffice15"
cscript ospp.vbs /dstatus
cd /d "%ProgramFiles%Microsoft OfficeOffice14"
cscript ospp.vbs /dstatus
You can also check the corresponding 32-bit locations:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
cd /d "%ProgramFiles(x86)%Microsoft OfficeOffice15"
cscript ospp.vbs /dstatus
cd /d "%ProgramFiles(x86)%Microsoft OfficeOffice14"
cscript ospp.vbs /dstatus
Use the command that matches the folder containing ospp.vbs. If the cd command reports that the path does not exist, try the next path.
Find the script automatically
If you do not know where Office is installed, search the usual installation directories:
where /r "%ProgramFiles%Microsoft Office" ospp.vbs
where /r "%ProgramFiles(x86)%Microsoft Office" ospp.vbs
If Windows returns a path such as:
C:Program FilesMicrosoft OfficerootOffice16ospp.vbs
Run the script using its full path:
cscript "C:Program FilesMicrosoft OfficerootOffice16ospp.vbs" /dstatus
Some Click-to-Run installations place the script in a rootOffice16 subfolder rather than directly in Microsoft OfficeOffice16. The full-path method avoids guessing the folder.
What this command can and cannot show
| Command output or situation | What it means |
|---|---|
LICENSE STATUS: ---LICENSED--- |
The reported Office license is activated. |
| Last five characters are shown | These characters identify an installed key; the complete key is not displayed. |
| Multiple license entries appear | More than one Office product key or license component may be installed. |
ospp.vbs is missing |
The installation may use a different licensing system, such as a Microsoft Store installation, or the Office files are in another location. |
| No full 25-character key appears | This is normal. The script is not a universal product-key recovery tool. |
Do not mistake the last five characters for a complete key. A Microsoft Office product key has 25 characters in five groups, for example XXXXX-XXXXX-XXXXX-XXXXX-XXXXX, but the licensing script intentionally reports only a short identifying portion.
Recommended Free Tools
Check whether Office is activated without recovering a key
You can inspect Office’s account and activation information from an Office application:
- Open Word, Excel, or another Office program.
- Select File > Account.
- Look under Product Information.
This area can show the product name, activation status, and the Microsoft account associated with a Microsoft 365 subscription or redeemed purchase. The account is often more useful than a product key when reinstalling Office.
For Microsoft 365, activation normally follows the signed-in Microsoft account. Sign in at account.microsoft.com/services to view subscriptions and available installs. An Office product key may have been used when the license was first redeemed, but the redeemed key is not normally displayed again as a complete key.
Where to look for a lost Office key
Command Prompt cannot reconstruct a key that is no longer available. Check the original purchase source instead:
- Retail purchase: search the purchase-confirmation email or the retailer’s online account.
- Product-key card: check the card or packaging for the 25-character code.
- Office supplied with a computer: check the paperwork, packaging, or any license label supplied with the device.
- Microsoft account purchase: check the Services and subscriptions page rather than looking for a displayed key.
- Work or school Office: contact the organization’s Microsoft 365 administrator or licensing team.
Be cautious with websites and utilities that promise to reveal a complete Office key from the registry. They may show an installation identifier, a partial key, or a generic volume-license key rather than the license that was actually purchased. Some key-finder tools also require broad system permissions and can expose sensitive information.
Why registry commands usually do not solve this
Older Office installations sometimes stored licensing-related values in the registry, which led to scripts claiming to recover the full key. Modern Office licensing can use Click-to-Run records, subscription authentication, volume activation, or a digitally linked account. Those records do not guarantee that the original 25-character key is stored in recoverable form.
A registry value or Office product ID is not automatically the product key. It should not be used as a replacement key during installation.
Use a replacement key
If you already have a valid key and need to apply it, the exact process depends on the Office edition. In many desktop versions, open an Office application and go to File > Account > Change Product Key, if that option is available. You can then enter the 25-character code.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteFor Microsoft 365, sign in with the account that owns the subscription instead. For volume-license editions, activation may require the organization’s KMS server or a Multiple Activation Key supplied by the administrator.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Common errors
“Input Error: Can not find script file ospp.vbs”
You are in the wrong directory, or that installation does not include the script. Try the Office16, Office15, and Office14 paths above, including the Program Files (x86) locations. The automatic where search can locate it if it exists under the standard Office directory.
The command returns an unlicensed status
The installed Office product is not currently activated through that license entry. Open File > Account, sign in with the correct account, or contact the organization that supplied the license. Reinstalling Office alone will not create a valid license.
The command returns several keys
Office can retain multiple license entries after upgrades, repairs, or changes between editions. Compare the product names, descriptions, status values, and last five characters. Do not assume that the first entry is the license currently being used.
Command Prompt reports an access or permission error
Close Office applications, reopen Command Prompt with Run as administrator, and run the command again. Some licensing operations require elevation.
FAQ
Can Command Prompt show my complete Microsoft Office product key?
Usually no. The Office licensing script can show activation details and the last five characters of an installed key, but it does not normally reveal the complete 25-character key.
What is the command to check an Office key?
Open an elevated Command Prompt, change to the Office folder, and run cscript ospp.vbs /dstatus. For many installations, the folder is %ProgramFiles%Microsoft OfficeOffice16; 32-bit Office may use %ProgramFiles(x86)% instead.
Why does ospp.vbs not show a key?
The installation may use Microsoft 365 account activation, a Microsoft Store licensing system, or another activation method. The script also intentionally reports only the last five characters rather than the full key.
Is a Microsoft 365 subscription linked to a product key?
A subscription is primarily linked to the Microsoft account used to activate it. Check account.microsoft.com/services and sign in with the account that owns the subscription.
Can I use the last five characters to reinstall Office?
No. They identify an installed license but are not enough to activate or reinstall Office. You need the original key, the associated Microsoft account, or activation supplied by your organization.
The Bottom Line
Use cscript ospp.vbs /dstatus to check Office’s license status and identify an installed key by its last five characters. Do not expect Command Prompt to recover the complete product key: modern Office installations often use account-based or digital activation, and the original key may only be available in the purchase email, retailer account, packaging, or Microsoft account that redeemed it.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

