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 batch script that will open a program in a different environment (so I can make a portable version of it).

I use this set APPDATA=%CD%\data to tell it to do that. The problem I'm facing is that I get the following error when the batch starts:

CMD.EXE was started with the above path as the current directory. UNC paths are not supported. Defaulting to Windows directory.

I want to, instead use the cd command to change it to the batch directory. Is there an easy way to do this?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

If it is on a network drive you might still have issues unless you map the drive buy why not do the following?

APPDATA=%~dp0
cd /d %APPDATA%

By doing a cls you can also clear the error but it the script is run from a UNC path you will receiving this error, you will just have to map it or CLS the error out.

share|improve this answer

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.