0

I'm writing a script that checks the serial number of the PCS motherboard and compares it to a number I've hardcoded in the script. If the numbers match, the script should continue. Here's what I've written so far, but I can't get the script to go to :menu. What am I doing wrong?

:hwid



cls

echo Please Enter Key

set /p hwid=<wmic baseboard get serialnumber>

if %hwid%==190958896502586 goto menu

if %hwid%==190958896502586 goto menu



if not %hwid%==test goto login

if not %hwid%==test2 goto login
SomethingDark
  • 13,229
  • 5
  • 50
  • 55
eboobo
  • 1
  • 2
    Are you using the literal command `set /p hwid=` to get the hwid value, or is that a placeholder for what the actual command you're using is? That line as written won't work, but I need to know if you're doing something different before I can give you a proper answer. – SomethingDark Jul 25 '21 at 21:02
  • That is what im using – eboobo Jul 25 '21 at 21:11
  • 1
    Does this answer your question? [i want to store the output of the below command in a variable in batch file](https://stackoverflow.com/questions/30840027/i-want-to-store-the-output-of-the-below-command-in-a-variable-in-batch-file) But also combined with https://stackoverflow.com/questions/34684734/for-f-with-wmic-unwanted-output/34695095#34695095 because you're parsing `wmic`. – SomethingDark Jul 25 '21 at 21:18
  • 4
    There is no need to store the value in a variable, because you already know what you're looking for, all you need is a single line command using `find.exe` to check the output from your `WMIC.exe` query. `%SystemRoot%\System32\wbem\WMIC.exe BaseBoard Where "SerialNumber='190958896502586'" Get SerialNumber 2>NUL | %SystemRoot%\System32\find.exe /I "190958896502586" 1>NUL && (GoTo Menu) || GoTo Login` – Compo Jul 25 '21 at 23:35
  • Hm… there is no label `:menu` or `:login` in your posted code… – aschipfl Jul 26 '21 at 16:58

0 Answers0