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

  • Home
  • SEARCH
  • 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 9259373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:38:35+00:00 2026-06-18T12:38:35+00:00

i have a problem in a string with variable included I read a key

  • 0

i have a problem in a string with variable included
I read a key in registry like this :

call:ReadReg "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" "Desktop"
echo %RegValue%

:ReadReg
FOR /F "usebackq tokens=1-3" %%A IN (`REG QUERY "%~1" /v "%~2" 2^>nul`) DO (
    set RegName=%%A
    set RegType=%%B
    set RegValue=%%C
)
goto:eof

but the value returned in RegValue is: %USERPROFILE%\Desktop
instead of : C:\Documents and Settings\username\Desktop

the ECHO line display :

C:\Documents and Settings\alopez>echo %USERPROFILE%\Bureau
%USERPROFILE%\Bureau

I would like convert the registry value into a good path

  • 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-06-18T12:38:36+00:00Added an answer on June 18, 2026 at 12:38 pm

    Replace set RegValue=%%C with call set RegValue=%%C This will cause variable expansion twice; once for the call command and then again for the set command. Run this example .bat script to see it in action.

    @echo off
    
    set x=%%Path%%
    echo %x%
    echo.
    call echo %x%
    call set x=%x%
    echo.
    echo %x%
    pause >nul
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have included string and just after call a string variable in a struct
I am facing problem to get variable from query string. I have used htaccess
I'm having a problem relating to storing a variable within Javascript. I have a
I am using LaTeX and I have a problem concerning string manipulation. I want
I have a problem with sending string via game center. I am able to
I have a problem that output string must be utf8-formatted, I am writing currently
I have a problem converting a string binary to a decimal I was using
I have a problem using the string function erase with iterators. The function below
Hello I have a problem with trimming string in c++. It adds some weird
I have some problem to get the utf-8 string from PHP using jQuery $.load()

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.