Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to create a shortened path to a directory that is nested in a lot of directories (ie C:\Users.......................................\TestApp\Data\32\TutorialData which is 80+ characters to %TestAPP%\Data\32\TutorialData).

I was able to accomplish this in part by using the setx command

setx TestApp "C:\Users\.......................................\TestApp"

Now when I navigate to %TestApp%\Data in explorer it opens up wonderfully, but it doesn't recognize the path in the open file dialog of other programs. Furthermore when explorer restarts the variable goes away. I tried

setx TestApp "C:\Users\.......................................\TestApp" /m

Which is supposed to set it as a system variable but then it doesn't load %TestApp%\Data because it says it can't find "C:\Users.......................................\TestApp /m\Data"

EDIT: (I only see this error from the open file dialog)

What do I need to do differently to accomplish this so it will work in open file dialogs and persist rebooting the computer?


I'm not sure at this point what happened before, in trying it on a separate computer / after reboot I didn't see that problem.

That said, I realized that this would not accomplish what I was hoping to anyways, because in open file dialogs %TestApp% still resolves to the full path, which I was hoping to shorten (I'm using an old program I don't have the code for that breaks because it only stores file paths in an array of 80 characters, additional ones are truncated).

The resulting questions that come up because of this are different enough from the original question it's not worth editing. The only thing to supplement would be if someone wanted to show how to have the variable persist, but it wouldn't serve to help me personally at this point, just potential future searchers.

share|improve this question

migrated from stackoverflow.com May 11 '13 at 4:11

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 0 down vote accepted

I think you could benefit from using a junction point instead. The tool you need is called 'mklink':

mklink /J C:\TestApp\ C:\..........\TestApp\

Then, navigate to C:\TestApp\ and you should see everything that exists in C:..........\TestApp\

This trick also works across different volumes.

share|improve this answer
    
Indeed that is the tool I need in this case. When I realized this I wasn't sure what to do with this question. I see it was migrated for me as I guess this isn't exactly a 'programming question'. But this answer is as good as can happen so +1 :) –  Assimilater May 13 '13 at 0:52

The fact its looking for /m\Data means you must have forgotten to close the path quote

setx x "c:\foo /m

sets x to "c:\foo /m" so %x%\data is "c:\foo /mdata

You can check this by looking under Variables on the advanced tab of sysdm.cpl

share|improve this answer
    
Should have clarified it only showed that error from the open file dialog, still worked fine from windows explorer. Looking in the environment variables I can see %Test91% set to the value of the dir without /m. Also what of the second part of the question about the variable persisting after explorer reboot? Thanks for you time –  Assimilater May 10 '13 at 16:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.