I cannot get CMD or powershell to access anything beyond the first sub directory on a drive without typing the full path. Keeps telling me the system cannot find the specified path.
i.e. This works:
d: cd \dev jobs
and this works:
d: cd \dev jobs\sites
but this doesn't work
d:\dev jobs> cd \sites
I'm running latest windows 10.
c: is my system drive
replicated this proess in the c drive directory and met with the same results
(Please, I'm not asking how to change directories but rather understand why the command line seems to be misbehaving)
Any ideas or suggestions on where to start?
Thank you for your help
Why the unuseful comment vote? That's the right answer.
If you are in d:\dev jobs and you cd sites, it will work. From d:\dev jobs, cd \sites does not work because it is looking for sites in the root folder (ie. d:\sites).
You want to use a relative path there.
Related
For school, I have to switch between my top level directory which is git-basics-lab-online-web-sp-000 back to the sub directory I made which is called my-repository.
I was switching back and forth no problem using {cd} but when I tried to switch back to my-repository using
cd my-repository
my terminal is now saying
bash: cd: my-repository: No such file or directory
what did I do wrong?! How come it worked before but now it's giving me this message?
Perhaps we are missing more information. That is, if you moved correctly from one directory to another, there is no reason why it should disappear just like that.
Besides cd, there are other commands that will help you to know which directory you are in, and where you can go. I summarize them below:
Show the full path to the current directory:
pwd
List files and folders (except hidden ones):
ls
Enter the dir directory (assuming it exists where we are):
cd dir
Exit dir (see edit):
cd ..
Obviously each command has a number of options that increase its functionality. You can always access them with the man command (for example, man cd will show you the cd command help).
That is, once the terminal showed you the error you mention, you can run ls to verify, for example, if you typed the folder name wrong. Then you can also try pwd to confirm that you are where you think you are. And finally you can move with cd to where you think you are.
EDIT: As suggested by Roadowl, cd - and cd .. are not strictly the same thing (in the example I assume we go one directory at a time).
I will try to illustrate this with an example to show the difference.
Suppose we have the dirc folder inside dirb and this, in turn, inside dira ( dira/dirb/dirc ). Let us also suppose that we are in dira. To enter directly to dirc we would have to execute cd dirb/dirc. And this is where the difference is illustrated:
If we run cd .. we are going to be positioned in dirb.
If we run cd - we will go back to the dira directory we were in before running the command.
This error message simply means that the directory/file you specified could not be found at your current location. If you look to the left of where you are typing, your current directory should be displayed, something like /you/are/here/ >
You can type cd .. to navigate up one level (towards the root directory).
If you are sure the directory exists you are trying to cd into, then you probably just aren't currently in the right location, and you need to either cd .. or cd somewhereelse until you get there.
Using VS Code terminal, a certain directory keeps popping up as default :
C:\Users\user\name\folder1\folder2\folder3\folder4
How do move back up with one single command instead of doing multiple "cd ../.."
Much appreciated!
Sorry I am answering for CMD as it was tagged CMD, I'm not sure how this affects VSCode. So, I'm not sure if I should just delete this or if it is actually relevant. Please let me know.
What folder do you want to go to?
Using your Example C:\Users\user\name\folder1\folder2\folder3\folder4
If you would like to go to the root CD \ will do.
If you would like to go up 4 directories CD ..\..\..\.. will do
If you want to go up 4 directories and back down 3 CD ..\..\..\..\folder1\folder2\folder3
If you want to always go to a specific directory on the current disk CD \Path\to\directory
If you want to always go to a specific folder on another disk CD /D DriveLetter:\Path\To\Folder (eg CD /D X:\Path\To\Folder)
In VScode, add the exact folder in Workspace, you want to open terminal from.
I started using fish today via Cygwin on Windows 10.
Whenever I execute
ls "G:/My Drive/"
I get a list of files and folders within that directory, which indicates that it can find the directory I am pointing ls to.
However, when I execute
cd "G:/My Drive/"
I get an error:
cd: The directory “G:/My Drive/” does not exist
I reinstalled Cygwin and also updated fish and it still behaves the same.
Why doesn't cd work?
I discovered why this was happening; perhaps it can help others who experience the same problem.
It turns out that fish was mounted onto my drive, so instead of typing
cd "G:/My Drive/"
I have to type
cd /cygdrive/g/My\ Drive/dataSources/
UPDATE (27th March 2019):
I found some documentation that highlights this in more detail.
I am using cmd to access C directory in windows 10. But it always go to C:\Users\LENOVO>. Actually I have to go to xampp folder in C drive. I have tried a few options but could not reach to xampp.
Some of them are:
C:\Users\LENOVO>C:
This results to C:\Users\LENOVO>.
Another one,
C:\Users\LENOVO>C: cd xampp
This also results the same: C:\Users\LENOVO>.
So please help me to access xampp folder which is in C drive as the cmd is always on
C:\Users\LENOVO>
However writing D: to cmd go to
D:\>.
This is not a valid command.
C: cd xampp
Use this instead.
CD C:\xampp
or
CD /D C:\xampp
The /D switch is explained in the help information using CD /?. It will also change the current drive letter. If you are currently on a D: directory, just using CD C:\Users\me will change the current directory on C:, but it will not change the current working drive away from D:.
Try cd / or maybe cd ../..
Both of these options will take you to base directory.
Open your command prompt. Write on it cd xampp then you reach on this folder.
I am having an issue with the windows cmd line. When I cd into my Users dir my user folder shows as there but I cannot cd into. The path cd\Users\gmenfan83\ is my desired location. However, when I am in the Users dir and cd\Users\gmenfan83 \ I get a "The path is not found or specified" . I am more of a nix user but if the folder shows in the directory tree shouldn't I be able to cd into it? Thank you
Are you trying to use cd/Users/gmenfan83 while you have already used cd/Users? In that case you will not be able to find the file since you are already in the Users folder. Typing cd \Users\gmenfan83 right after opening cmd with C drive path should get you there.
It's unclear (even after your edit) what specifically you're doing, but this should get you started.
If you're currently in C:\users, and you want to change into the C:\Users\gmenfan83 folder, all you need is cd gmenfan83. If you're in C:\, all you need is cd users\gmenfan83.
Relative paths also work in Windows cmd.exe just as they do under *nix. To change from C:\users\gmenfan83\test to C:\users\gmenfan83\temp, you can use cd ..\temp, or specify cd \users\gmenfan83\temp.