Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1044517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:50:27+00:00 2026-05-16T15:50:27+00:00

I was reading the Windows Commandline Documentation (Win+F1) about the commands that modify the

  • 0

I was reading the Windows Commandline Documentation (Win+F1) about the commands that modify the Windows registry, particularly the the “reg add” command.

reg add HKCU\testfolder /t REG_EXPAND_SZ /v Stokrotka /d "%systemroot%\system32"

Now, I don’t know how this was designed to work.
When I invoke the command above, the variable %systemroot% gets expanded to C:\Windows. I’ve tried the following not to make the variable to expand, but there is no way I could force it not to:

  • escaping the `%%`’s with an `%, ^, \` – doesn’t work even if I use double quotes around
  • using the single quotes ” around the whole /d string
  • use `setlocal setdelayedexpansion`? sth like:

# (setlocal enabledelayedexpansion) && (reg add HKCU\testfolder /t REG_EXPAND_SZ /v Stokrotka /d "!systemroot!\system32") && (setlocal disabledelayedexpansion)

The variable ‘data’ (/d) field is either like ^%systemroot^% or like !systemroot! or just expands to C:\windows .
I could probably use the .reg file to accomplish my task, but I simply don’t want to do it.
I thought that maybe there is something wrong with the program that I use to display the variable contents (regedit / regedt32 / reg query (commandline)), but after checking this is probably not the case.
Any ideas? I’m mainly interested how the variable value should look like in the regedit window, should it be like :"%systemroot%\system32" or "C:\windows\system32" to be properly expanded by other programs.
Regards.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:50:27+00:00Added an answer on May 16, 2026 at 3:50 pm

    From a command line, this worked for me:

    reg add HKCU\testfolder /t REG_EXPAND_SZ /v Stokrotka /d ^%systemroot^%\system32
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 542k
  • Answers 542k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It will take longer to serve pages from a database-based… May 17, 2026 at 3:13 am
  • Editorial Team
    Editorial Team added an answer A session will probably be the easiest, or still detect… May 17, 2026 at 3:13 am
  • Editorial Team
    Editorial Team added an answer So this didn't seem very popular, however I did manage… May 17, 2026 at 3:13 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

We have a C# Windows service that currently processes all the PDFs by reading
I find from reading perldoc perlvar, about a thousand lines in is help for
On the Windows command line and cygwin bash I can execute the following without
Why are there no good drivers for Windows for reading ext2/3/4 filesystems? Googling around
I was just reading Rx HOL NET. Upon finding (example uses Windows Forms): var
Our Windows file server has an archive service installed that stubs files that have
Briefly: Does anyone know of a GUI for gdb that brings it on par
I recent added source file parsing to an existing tool that generated output files
I use Launch4j as a wrapper for my Java application under Windows 7, which,
I have Windows application in csproj in my solution, and I want generate Publish

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.