Jump to content

LT Script to check folder Redirection

Recommended Posts



Im new to LT and have only started looking at scripts.


I require a script to be pushed out through LT that preferably returns the redirection value of a user's my docs.


I've tried creating an LT script with a Shell function

REG query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /f Personal


It returns

%USERPROFILE%\My Documents


I instead need something along the lines of

C:\users\username\My Documents


Can anyone advise how to fix this or advise on another way to get the folder redirection value for My Docs for the current logged in user?


Thanks in advance.




Share this post

Link to post
Share on other sites

You can do a Shell Encanced:

Command: %userprofile%

Variable List: Profile


Now you have the user profile path in a variable %Profile%

Share this post

Link to post
Share on other sites

You have to use the "If Logged In User" function, then the Console Execute, to get the variable resolved in the logged in users context. (With a command like "echo %userprofile%"). With the standard Shell Execute or Shell Execute Enhanced, you are going to get results from the SYSTEM account, not the logged in user.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...