Scripting Question

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

07/19/2012 12868 views

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


Answer Summary:
cmd /c "xcopy %SystemDrive%\Atlas\GlobeSoftware %AppData%\GlobeSoftware\ /e /c /y"
0 Comments   [ + ] Show comments


Community Chosen Answer


StubPath value should be like this

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

Answered 07/19/2012 by: jagadeish
Red Belt

  • You can use %SystemDrive% in place of C:
    cmd /c "xcopy %SystemDrive%\Atlas\GlobeSoftware %AppData%\GlobeSoftware\ /e /c /y"
  • APPDATA=C:\Users\[CurrentlyLoggedInUser]\AppData\Roaming
    in Windows 7

All Answers


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

Answered 07/19/2012 by: krulik
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!

Answered 07/22/2012 by: nbafifa02
Senior Yellow 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:


Answered 07/19/2012 by: piyushnasa
Red Belt

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