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.

Calling %systemdrive% from the registry?

Featured Replies

here's the deal:

i am trying to get a RunOnce command into the registry which calls a bat in my OEM share. this works just fine when i specify the drive letter, but it refuses to accept %systemdrive% in the place of C: (or D: or whatever drive). is there an alternate syntax for this? i have a work-around but it's not that great so i figured i'd ask...


environment variables won't work in .reg files. REG ADD does.

REG ADD /? from the Command Prompt

To use environment variables it has to be a REG_EXPAND_SZ key

REG ADD /? will show you as Aaron pointed out and it support's the REG_EXPAND also

REG ADD HKLM\Software\MyCo /v Path /t REG_EXPAND_SZ /d %%systemroot%%

Adds a value (name: Path, type: REG_EXPAND_SZ, data: %systemroot%)

Notice: Use the double percentage ( %% ) inside the expand string

my way of doing it might be slightly easier, maybe (for me it is, I know nothing about registry editing)...

I have a batch file something like this:

@echo offif %systemdrive% == C: goto :c_driveif %systemdrive% == D: goto _drivegoto :error:c_drivereg /import %systemdrive%\install\imports\c-drive.reggoto :end_drivereg /import %systemdrive%\install\imports\d-drive.reggoto :end:errorecho Silly drive letters like %systemdrive% not supported!:end

so as you can see, I have a similar need as you do of adding entries to the registry that will obviously not be the same if the drive assignment for %systemdrive% is different.... I just have different copies of the registry files that point to different drive letters like above...

I hope this helps a little

  • Author

that doesn't work.

this is because %systemdrive% resolves to a drive letter followed by a colon. you cannot have a colon in a filename, so the bat points at a file which doesn't exist, and then your reg file is not imported...

Crusher,Apr 18 2004, 09:22 PM]hmm.. i just thought of an easier way
@echo off

reg /import %systemdrive%-drive.reg

This will work:

reg /import %systemdrive:~0,1%-drive.reg

Syntax (see set /?):

%variable:~[+-]offset,[+-]# of characters%

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.