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.

Double backslash confusion

Featured Replies

Guys, can you tell me where exactly do I NEED to use double backslashes please? I tried to google it up and didn't get any definite answer. I never used it once and never had a problem. Various sources say I MUST use double backslashes in scripts, but that's quite general statement. Never had problems using single backslash in .reg files, batch files, or unattended one.

Hm. I always used it in batch files and .reg files without problems. Never used it in unattended answer file either. Everything always worked...

It's more a factor of what other pieces of software are involved - not just batch and .reg files by themselves which in general do not require double backslashes. There are other utilities that use the backslash as an escape character. For example, you might have seen references to "\n" being used to represent a "new line"? This is true in all the various versions of C, C++, etc. Anyway, since the backslash is used as an escape character, then if you really wanted to use a backslash as a backslash, you have to double it up, ie escape the escape character. I usually see doubled backslashes used for code that is run during Windows installation routines, since many of those routines are written in C++. But someone else will need to give you better specifics. I can just tell you the "why", not the "when". Sorry.

Cheers and Regards

Various sources say I MUST use double backslashes in scripts

Can you name a example?

Never had problems using single backslash in .reg files,

A Reg_sz entry uses double backslashes at path.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Browser]
"DisplayName"="@%systemroot%\\system32\\browser.dll,-100"

batch files
A regular expression search string may use double backslashes to escape a single backslash

http://technet.microsoft.com/en-us/library/bb490907.aspx

Can't name any specific, just people on forums and articles I read in past...

Fair enough with the registry, but why does it work with single backslash as well?

example:

reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Themes /v InstallTheme /t REG_SZ /d "%SystemDrive%\Windows\Resources\Themes\AeroNoBackground.theme" /f

why does it work with single backslash as well?

This example uses reg.exe to set a entry.

Reg.exe is another application with own rules: single backslash is appropiate

This is not a .reg file.

if I export a reg key and it has the \\ then I simply use that.

Here is perfect example where if you don't then it won't work.

First reg file that works

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\Kill Not Responding Tasks\command]
@="C:\\Windows\\System32\\taskkill.exe /F /FI \"STATUS eq NOT RESPONDING\""

Now we remove \\ and it say it import but you open key and it is blank

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\Kill Not Responding Tasks\command]
@="C:\Windows\System32\taskkill.exe /F /FI \"STATUS eq NOT RESPONDING\""

EDIT: You must delete key before second import to see this

Case closed?

Edited by maxXPsoft

Now I understand, I guess you need to use the double backslash for setting theme registry as the default registry is like this:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes]
"Drop Shadow"="FALSE"
"Flat Menus"="FALSE"
"SetupVersion"="10"
"InstallTheme"="C:\\Windows\\resources\\Themes\\aero.theme"
"InstallVisualStyle"="%ResourceDir%\\themes\\Aero\\Aero.msstyles"

Now I understand, I guess you need to use the double backslash for setting theme registry as the default registry is like this:

I had not tampered with that theme key but I exported same key and it does contain \\ as default.

There are certain keys that won't work unless you \\. I have no explanation but if you export and they contain then you best use them.

Now I understand, I guess you need to use the double backslash for setting theme registry as the default registry is like this:

It's not about theme.

It's about a file name with a path. This goes to all folder file names.

"InstallVisualStyle"="%ResourceDir%\\themes\\Aero\\Aero.msstyles"

Seems to be a default bug: a RegSz dosn't expand a %ResourceDir% entry.

Seems to be a default bug: a RegSz dosn't expand a %ResourceDir% entry.

hadn't noticed that till you said something.

Type set in a cmd prompt. There is no %ResourceDir%

Google returns nothing on it either

MS Bug for sure.

Edited by maxXPsoft

%ResourceDir% is internal Windows thing. Doing a file content search I find this in many files.

post-9484-0-88185000-1333957738_thumb.pn

Edited by maxXPsoft

I don't doubt %ResourceDir%. I doubt the type Reg_SZ.

A XP themeui.dll sets

HKLM,"Software\Microsoft\Windows\CurrentVersion\Themes\VisualStyleDirs","1",%REGEXSZ%,"%%ResourceDir%%\Themes"

This setting exist at Windows 7 too.

That's type Reg_Expand_SZ to %ResourceDir%.

Can anybody clarify this?

Which part uses %ResourceDir% ? Which part expand the string?

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.