Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: C:\ verses %systemdrive%  (Read 2879 times)

0 Members and 1 Guest are viewing this topic.

dvdljns

  • Guest
C:\ verses %systemdrive%
« on: February 18, 2010, 08:40:07 AM »
I change a lot of programs over to stand alone programs. Which means I Change the c path in the program to systemdrive and excetra but sometimes it does not work. If the program needs to pull up a cmd prompt I get an error. Is there a way I can set it up to stop this. I would like to stop this behavier and change all paths in my registry to variables..

patio

  • Moderator


  • Genius
  • Maud' Dib
  • Thanked: 1769
    • Yes
  • Experience: Beginner
  • OS: Windows 7
Re: C:\ verses %systemdrive%
« Reply #1 on: February 18, 2010, 08:45:05 AM »
I'm not sure i'm clear on what your goals are here...
Won't changing app locations break the association in the registry ? ?
" Anyone who goes to a psychiatrist should have his head examined. "

Allan

  • Moderator

  • Mastermind
  • Thanked: 1260
  • Experience: Guru
  • OS: Windows 10
Re: C:\ verses %systemdrive%
« Reply #2 on: February 18, 2010, 09:37:15 AM »
patio is being very polite. Personally, I have absolutely no idea what you are talking about.

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: C:\ verses %systemdrive%
« Reply #3 on: February 18, 2010, 02:19:51 PM »
%systemDrive% reflects the current system drive.

%programfiles% is not always on %systemdrive%. if that's the case then any use of %systemdrive% would go to the wrong drive.

And, if the program purposely installs to %systemdrive% and saves it as an absolute path, such as C:\ in the registry during installation, you must consider that your systemdrive can only change when you reinstall windows.

At which point you would need to reinstall the program. At which point the value is written with the new system drive.

I'm not even clear on what the entire aim is here. Changing all the "absolute paths" in the registry that will only change after a system reinstall is a tad silly. Additionally, remember that the programs reading the strings might not even expand environment variables; this is especially true for "REG_SZ" values as opposed to "REG_EXPAND_SZ" values. at which point the program will literally try to view a path called "%SystemDrive%" and fail miserably.
I was trying to dereference Null Pointers before it was cool.

patio

  • Moderator


  • Genius
  • Maud' Dib
  • Thanked: 1769
    • Yes
  • Experience: Beginner
  • OS: Windows 7
Re: C:\ verses %systemdrive%
« Reply #4 on: February 18, 2010, 05:37:45 PM »
Personally...i'd just install things to where you want them.
" Anyone who goes to a psychiatrist should have his head examined. "

Allan

  • Moderator

  • Mastermind
  • Thanked: 1260
  • Experience: Guru
  • OS: Windows 10
Re: C:\ verses %systemdrive%
« Reply #5 on: February 19, 2010, 05:38:46 AM »
Personally...i'd just install things to where you want them.
Exactly!

jkolak



    Hopeful
  • Thanked: 23
    Re: C:\ verses %systemdrive%
    « Reply #6 on: February 19, 2010, 08:28:06 AM »
    Right. The days of portable programs is largely over, though there are some simple programs which do not use the registry.

    Plus, after you jump through all those hoops to rewrite the registry entries, modern programs write to Documents and Settings as well, so you will not get many programs to be self-contained in their program folder.