I have an old VB.NET application from 2008 that uses Environment.SpecialFolder.CommonApplicationData to store it's settings and data. This works perfectly fine when a user uses the application from a windows PC. However, we are being asked to move this application to Remote Desktop Services, which causes the application to malfunction when >1 person uses the application.

What I would like to do is write a script (powershell / batch file) that sets the CommonApplicationData environment variable to a value specified in the batch file so that RDS users can run this.

Something along the lines of this..

Set CommonApplicationData = 'C:\..\..\%username%\MySessionThatIsUniqueToMe'

Thank-you in advance.

EDIT: Powershell looks like the way to go ? enter image description here

  • Your approach should work but you need to remove the spaces around =, use double quotes " and possibly escape the backslashes.
    – DavidPostill
    Commented Apr 1, 2020 at 15:11
  • 1
    What doesn't work well with your above script? Apart from the fact that the command should be written as set CommonApplicationData=C:\..\..\%username%\MySessionThatIsUniqueToMe. See link.
    – harrymc
    Commented Apr 1, 2020 at 15:11
  • It's the inbuilt OS level CommonApplicationData that needs to be changed
    – AkpoaA
    Commented Apr 1, 2020 at 19:11


You must log in to answer this question.

Browse other questions tagged .