Issue with win cmd finding folders - windows

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.

Related

How to move up multiple folder

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.

CMD won't execute basic CD \

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.

I am trying to access "C" directory using cmd (Windows 10), but it's not working?

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.

Cannot find file to delete via git bash, but it shows up in file explorer

I started to learn git yesterday, and I made a mistake when I created ssh key as the first image shows.
I tried .bat delete way and dos del command, still cannot delete file named cd ..
The prompt said cannot find file. The attribute of file size is 0 byte.
How to delete this file?
I managed to delete "cd .." in a CMD Windows with <path/to/git>\latest\usr\bin in %PATH%. That gives me access to rm.exe.
vonc#VONCAVN7 C:\test
> where rm
D:\prgs\git\latest\usr\bin\rm.exe
I had:
vonc#VONCAVN7 C:\test
> dir /x
Volume in drive C is test
Directory of C:\test
08/08/2017 07:11 <DIR> .
08/08/2017 07:11 <DIR> ..
08/08/2017 07:11 0 cd ..
With that, I typed:
vonc#VONCAVN7 C:\test
> rm cd*
And the file cd .. was gone
As commented by eryksun,
rm.exe isn't a Linux app. It uses msys-2.0.dll, which links with Windows API functions from kernel32.dll and native NT system calls from ntdll.dll.
In this case it's how it bypasses the Windows API to make direct system calls that solves the problem: NtOpenFile (open the directory to list it and the "cd .." file to delete it), NtQueryDirectoryFile (list the directory), and NtSetInformationFile (set the file's delete disposition).
As eryksun commented, the pure Windows syntax (meaning, it does not need a Git Linux-like command like rm) would have worked too:
del "\\?\C:\test\cd .."
See "What does \\?\ mean when prepended to a file path".
That will disable all string parsing and send the string that follows it straight to the file system.
Look into the properties of the file. There you may find file location. Go to that location and delete from there.
And see which type of file is it. I mean, it may be a system file, and if it is, system will not allow you to delete it. Open explorer as administrator and then try deleting it.

change working directory to one located on a different volume in cmd

In the command prompt I am able to change the working directory by typing CD "new path"
for example take a look on how I am able to select directories that are located in my C drive:
but note that when I select a directory located in a different volume (A:...) the command prompt will not change the working directory...
cd /d A:\Users does what your looking for.

Resources