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 8635995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:06:49+00:00 2026-06-12T10:06:49+00:00

Well, I have been told time and time again that system command is bad,

  • 0

Well, I have been told time and time again that system command is bad, but I need to change a registry value and my forte is batch so I have a commmand in mind that does it:

system("REG ADD "HKCU\Control Panel\Desktop" /V Wallpaper /T REG_SZ /F /D "C:\background.bmp"");
system("REG ADD "HKCU\Control Panel\Desktop" /V WallpaperStyle /T REG_SZ /F /D 0");
system("REG ADD "HKCU\Control Panel\Desktop" /V TileWallpaper /T REG_SZ /F /D 2");
system("%SystemRoot%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters");

However, using this makes Visual C++ 2010 Express highlight HKCU and the slash betweeen Panel and Desktop as an error and does not allow me to compile or debug my program. I don’t want to use the system command so I was wondering how to use a C++ to preform the same registry command?
I DON’T UNDERSTAND WIN32 REGISTRY API???

And is it ok to use the system command for this

system("%SystemRoot%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters");

because I don’t know if C++ can preform the same task without it, and if it can how???

Sorry, I know it’s a big question but if possible could you please include code, I am just beginning and none of the other forums make any sense and I have been looking for atlease three hours (I am not stupid with computers either)!!!

Thanks in advance

  • 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-12T10:06:51+00:00Added an answer on June 12, 2026 at 10:06 am

    Some extra work is needed to write string literals that contain special characters. For example, in your code, the " after ADD is the end of the string.

    You need to put a backspace before each special character (includes quotes and backspaces) to make sure they are put into the string instead of being processed by the compiler. This is called escaping.

    The result will look like this:

    system("REG ADD \"HKCU\\Control Panel\\Desktop\" /V Wallpaper /T REG_SZ /F /D \"C:\\background.bmp\"");
    

    Using the Registry API is a better option for your task, of course, but you also needed to know how to write string literals properly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Similar questions have been asked but cannot find a solution that works well. What
I have been to the zotonic docs , but well, they have not really
Disclaimer I am well aware that PHP might not have been the best choice
I have a WCF service that I am consuming, and have been doing well
I have been told that SQL Native Client is supposed to be faster than
I know that it has been told almost anything related to time table modeling
I have often been told that I should not use multiple return points, instead
Well I have been writing in the same style for awhile now and all
The differences between StringBuilder and StringBuffer in Java are well documented and have been
I have been using LinqToSQL for quite a while as well as using Devart,

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.