Hi!

I have this property that i need to set a folder path with the currently logged on user.
Is this possible without VBS?

For example PATH = C:\testfolder\[USERNAME]_folder\Anotherfolder

Thanks in advance!

// Bartoooo
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

2
Hi Bartoooo (Surprised I didn’t forget a “o” there)

What is the reason that you don’t want to use a vbs? I only ask this because I ran into a very similar problem however the guy training me up advised me heavily against creating the folder through the MSI tables – this is because the application that I had to do it for required one folder per user that logged on. So in that instance a vbs script in combination with a active script was the best option for me.

Sorry that my answer doesn’t really help as much as it could but I will have a play around and see if I can find anything out this afternoon.

Spef
Hopefully some packaging tips coming to www.spefdata.com
Answered 03/19/2012 by: Spef
Orange Senior Belt

  • You could use a batch file for this, and use the %USERNAME% environment variable when creating the folder.
    • Yea - The best way to do it would be imbed a VBScript/Batch into the MSI and/or active setup but he also said that he hoped to do it without VBS
      • Why i want to do this without VBS is because i thought it was best practice without VBS but if you say its the best way then maybe i can use it anyway.

        I always hear from people that package alot that VBS is "noob-style" :)
  • The only reason you would need a user-level folder added to the PATH environment variable is for an application to be able to find its support files, which begs the question why you have binaries in the user area?
    • Its the application that store some configurationfiles there.

      First its C:\Users\\config.ini
      And second C:\Users\\anotherfile.cps

      The Ini file conatains a path for the "Anotherfile.cps" (And other paths aswell) which stores personalized data for the application.

      Default is that the application copies the files to userprofile first time you start the application but now i have solved it by copy the .CPS file from installdir and craete the INI file with VBS. I have also added an Repair entry in Active Setup in the registry som this will happen to all users that logs on.

      The problem is that because i distribute the program through SCCM then the %userprofile% variable wont be the user that is currently logged on so i need to log off and on for the file to be created and copied :) Not nice, not nice at all! :=)

      I could maybe solve it with WMI in the VBscript but it seems so nooby. If i just could set the username with the property then the application will copy the files instead.

      // Bartoooo
Please log in to comment
2
Yes, it's possible by using LogonUser predefined property: http://msdn.microsoft.com/en-us/library/windows/desktop/aa369780(v=vs.85).aspx

and a type 51 custom action:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa368237(v=vs.85).aspx

Basically, a custom action can set the folder property to something like:

C:\testfolder\[LogonUser]_folder\Anotherfolder
Answered 03/20/2012 by: Cosmin Pirvu
Senior Yellow Belt

  • Thanks, but i will go with the VBS anyway.

    I am going to document this for the future :)
  • Okey turns out that the VBscript is creating some problems and i have tried your way without sucess.

    Could you please explain a little bit more in details on how to accomplish this?

    // Bartoooo
  • Which setup tool are you using? Also, what went wrong with the approach I suggested?
Please log in to comment
0
It's possible, but I'm concerned about doing that. If there are any features/components in an inconsistently named directory, repairs can get... interesting. Rather than doing that, why not store data in the profile of the logged in user? At least then you'd have a more consistent way of naming and accessing the information in those folders, and repairs/advertised shortcuts/activesetup would be a lot easier.

My $0.02
Answered 03/21/2012 by: Arminius
Second Degree Green Belt

  • The files is actually stored in the userprofile but there is a property containing the Path for that file.

    Example:

    C:\users\%USER%\config.ini <-- This file contains a Path for the folowing file:

    C:\Users\%User%\file.cps.

    And this Path is set by a Property!

    Its a weird application, i know, but i didnt made it :)
Please log in to comment
0
This is natively handled I can't imagine why u would need any ca at all.

Lookup self healing place the cps file in a component that has an hkcu entry as the keypath
Answered 03/22/2012 by: jmcfadyen
Fifth Degree Black Belt

Please log in to comment
0
This is natively handled I can't imagine why u would need any ca at all.

Lookup self healing place the cps file in a component that has an hkcu entry as the keypath
Answered 03/22/2012 by: jmcfadyen
Fifth Degree Black Belt

Please log in to comment
Answer this question or Comment on this question for clarity

Share