Jump to content

Recommended Posts

Posted (edited)

I'm writing a batch file that involves querying the OS to see if it is running Windows XP.

 

The failing bit of code is as follows:

 

REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\Currentversion" /v ProductName | FIND "Microsoft Windows XP"

 

When I run this, I get the following error:

 

ProductName REG_SZ Microsoft Windows XP

Error: They system was unable to find the specified registry key or value

 

 

I cannot see what is wrong with the command? Any pointers? Is it a stupid little spelling mistake?

 

Ta

 

Edit: These values are in the registry and I'm definitely running it on XP :-)

Edited by AyatollahPies
Missed out some vital info
Posted

Just tried this and it's telling me there are too many command-line parameters.

 

This is a fresh build I'm testing on too.

 

Think I need to try another workstation.

 

Cheers for the help.

Posted

We use:

 

ver | find "Windows XP" > nul

 

Would that work, or do you have a specific requirement to read the registry?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...