How to variablise %appdata% in StubPath key of Active Setup?

Hi, I have the below command needs to be set in the StubPath. It worked fine in DOS, but does not work in StubPath key. I tried to change %appdata% to hardcoded path and it worked. Can anyone please tell me how should I variablise %appdata%? Thanks.

xcopy C:\Atlas\GlobeSoftware %appdata%\GlobeSoftware\ /e /c /y


0 Comments   [ + ] Show comments

Answers (4)

Answer Summary:
cmd /c "xcopy %SystemDrive%\Atlas\GlobeSoftware %AppData%\GlobeSoftware\ /e /c /y"
Posted by: jagadeish 10 years ago
Red Belt

StubPath value should be like this

cmd /c "xcopy C:\Atlas\GlobeSoftware %AppData%\GlobeSoftware\ /e /c /y"

  • You can use %SystemDrive% in place of C:
    cmd /c "xcopy %SystemDrive%\Atlas\GlobeSoftware %AppData%\GlobeSoftware\ /e /c /y" - jagadeish 10 years ago
  • APPDATA=C:\Users\[CurrentlyLoggedInUser]\AppData\Roaming
    in Windows 7 - jagadeish 10 years ago
Posted by: krulik 10 years ago
Senior Yellow Belt

try to create a StubPath value as REG_EXPAND_SZ (by default will be set to  REG_SZ). 

Posted by: nbafifa02 10 years ago
Senior Yellow Belt

Thanks for everyone's help especially jagadeish. Simply adding cmd /c in front of the command worked. I really like this forum because I can find so many warmhearted people with similar interest. Thanks again!

Posted by: piyushnasa 10 years ago
Red Belt

I have too faced this issue before. Somehow I think Windows/CMD does not resolve the username properly through this. I may be wrong. I have even tried using a Powershell Script and it too does not work. The only thing which works perfectly fine is a VBScript.

Create a VBScript to copy this file and call VBScript in StubPath. I assure you it will work fine.

Take the script from here:


Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ