0

I am getting this error when I am doing a cd into a directory I stored in environment variables.

But the thing is, when I cd into the same directory using the same ev using , I can successfully cd into that directory.

This is true for all the directories stored in ev, even the $HOME path.

The environment variable is setup like this: Name %dev% Value E:\Software Development

  • Commands:
cd $dev
cd $HOME
cd $TMP

Non of the commands are working. But in vim..
:cd $dev does the job.

Image:

enter image description here enter image description here

10
  • Did you edit the path in the System- or User-level environment variables? Are you sure you're running in the same user scope for both the command-prompt as you are with Vim? IE: Does Vim run "as administrator" by any chance, and/or are you opening the command prompt "as administrator"? Commented Jan 16, 2015 at 16:26
  • I am running both without administrator privileges. I have added the custom path to user level, and I just tried the System-level $TMP and even it doesn't work (have tried both cmd and cmder), but again in vim $TMP and all other ev seem to work.
    – dw19
    Commented Jan 16, 2015 at 16:33
  • How exactly are you modifying the environment variables? Commented Jan 16, 2015 at 16:41
  • Through Advanced System Setting dialog.
    – dw19
    Commented Jan 16, 2015 at 16:43
  • Bizarre, well based on what you're provided it should just work. There must be a piece missing from your info someplace... Commented Jan 16, 2015 at 16:53

1 Answer 1

1

I told you that this would be quick once you asked the question properly.

You state that you are running

cd $TMP
in Microsoft's command interpreter, cmd.

That is not the syntax used for environment variable expansion in Microsoft's command interpreter. The syntax is

cd %TMP%
. Yes, the trailing percent sign is important.

2
  • It seems like user3224858 is confusing cmd with powershell but it is strange anyway :o
    – Vitas
    Commented Jan 18, 2015 at 19:56
  • Oh darn. It is working, but still, I can cd into ev that I have set myself, that is I can cd into HOME using: cd %HOME% but cd %dev% is not changing the directory and just keeping me in the current directory without giving any error.
    – dw19
    Commented Jan 20, 2015 at 12:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .