Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Batch file with variables not working?

Featured Replies

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


reg_sz does not work with variables, you need reg_expand_sz

  • Author

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?

  • Author

Problem solved:

The whitespaces around the equal sign have to go.

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

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

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.