Jump to content

Recommended Posts

Posted

Hello,

I have a small problem with the following script:

SET COMPNUM = 001

SET COMPNAME = TestClient%COMPNUM%

SET COMPNAME

REG add "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" /v ComputerName /t REG_SZ /d %COMPNAME% /f

Whenever I run the batch, the REG command shows up as

REG add "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" /v ComputerName /t REG_SZ /d /f

however the SET COMPNAME shows me "TestClient001", what am I doing wrong with that REG command?

Quick help would be very much appreciated! ;)

mf_2


Posted

The problem remains. Also, the REG_SZ has worked before. I really don't know why it's not working now. Does anybody have a clue?

Posted

Problem solved:

The whitespaces around the equal sign have to go.

"SET var=value" works like a charm, unlike "SET var = value"

Posted

Well I'm glad you spotted it, you'd have noticed it if you'd used the examples you'd already been given yesterday!

@Echo Off
Setlocal
(Set COMPNUM=001)
(Set COMPNAME=TestClient%COMPNUM%)
Reg Add HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName /v ComputerName /d "%COMPNAME%" /f>Nul

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...