Command Prompt Won't Change Directory To Another Drive
Có thể bạn quan tâm
-
- Home
- Questions
- Tags
- Users
- Companies
- Labs
- Jobs
- Discussions
- Collectives
-
Communities for your favorite technologies. Explore all Collectives
- Teams
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Try Teams for free Explore Teams - Teams
-
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about CollectivesTeams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsGet early access and see previews of new features.
Learn more about Labs Command prompt won't change directory to another drive Ask Question Asked 12 years, 6 months ago Modified 1 year, 7 months ago Viewed 1.1m times 557I'm trying to compile some java (learning java currently), and to do so I need to change command-prompt's directory.
C:\...\Admin> cd D:\Docs\Java C:\...\Admin> cd C:\...\AdminIt doesn't change the directory. I try again using quotes:
C:\...\Admin> cd "D:\Docs\Java" C:\...\Admin>Again it doesn't change the directory. What am I doing wrong?
Share Improve this question Follow edited Sep 12, 2021 at 3:08 nebuch asked Jun 16, 2012 at 17:04 nebuchnebuch 6,9954 gold badges22 silver badges43 bronze badges 0 Add a comment |14 Answers
Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 1003As @nasreddine answered or you can use /d
cd /d d:\Docs\JavaFor more help on the cd command use:
C:\Documents and Settings\kenny>help cdShare Improve this answer Follow edited May 23, 2017 at 11:55 CommunityBot 11 silver badge answered Jun 16, 2012 at 17:40 kennykenny 22.3k8 gold badges51 silver badges87 bronze badges 9Displays the name of or changes the current directory.
CHDIR [/D] [drive:][path] CHDIR [..] CD [/D] [drive:][path] CD [..]
.. Specifies that you want to change to the parent directory.
Type CD drive: to display the current directory in the specified drive. Type CD without parameters to display the current drive and directory.
Use the /D switch to change current drive in addition to changing current directory for a drive.
If Command Extensions are enabled CHDIR changes as follows:
The current directory string is converted to use the same case as the on disk names. So CD C:\TEMP would actually set the current directory to C:\Temp if that is the case on disk.
CHDIR command does not treat spaces as delimiters, so it is possible to CD into a subdirectory name that contains a space without surrounding the name with quotes. For example:
cd \winnt\profiles\username\programs\start menu
is the same as:
cd "\winnt\profiles\username\programs\start menu"
which is what you would have to type if extensions were disabled.
- 2 @SZaman in my experience. CD never changed drive letter without it. – kenny Commented Mar 10, 2017 at 14:53
- @kenny Indeed, it literally never has switched the drive letter, ever. – simontemplar Commented Apr 1, 2017 at 13:14
- 1 @kenny I wish rather than just be idle and do anything when you attempt to change to a directory on a different drive, it would give you an error message saying "ERROR - the file you're trying to access resides on another driver. Specify -d..." – committedandroider Commented Oct 22, 2019 at 22:21
- 1 @committedandroider yes it's a flaw for sure, just do it ;) – kenny Commented Oct 23, 2019 at 9:44
- 2 this isn't working for me in windows 11 – Lost Crotchet Commented Nov 23, 2022 at 20:00
The directory you're switching to is on another drive, you need to switch to that drive using :
C:\...\Admin> d:then you can cd into the directory you want.
C:\...\Admin> d: D:\>cd "Docs\Java" D:\Docs\Java> Share Improve this answer Follow edited Jun 16, 2012 at 17:32 answered Jun 16, 2012 at 17:11 NasreddineNasreddine 37.7k17 gold badges77 silver badges95 bronze badges 2- 2 @Prageethgodage: assume, you are on C:\my Folder and have files on a folder at another (network)drive in Z: Do a cd z:\very\long\path\you\dontwant\to\write\each\time. You are still on C:\my Folder). Then you can just dir z: (will list files on your very-long-path) or copy z:*.jpg (note: NOT z:\*.jpg!), which will copy files form your very-long-path. A simple z:` will switch to your Z: drive, where you are in your very-long-path. Very convenient, if you work a lot on command prompt. – Stephan Commented Aug 27, 2018 at 5:32
- 2 why can't directly change to that directory? What the hell is going on their developers mind?! – mohammadsdtmnd Commented Jan 1, 2023 at 15:11
Use drive letter d for changing to D drive like:
C:\> d:When changing drives, you just need to type the drive letter, like d: (don't use the backslash, like d:\ it doesn't work).
Share Improve this answer Follow edited Feb 1, 2023 at 16:09 answered Oct 8, 2015 at 11:34 KrishnaKrishna 5,6242 gold badges29 silver badges33 bronze badges 1You only use cd when moving between directories within the same drive.
- 3 This is the only right solution to change drives in Windows. Thank you! – gaya Commented Feb 18, 2022 at 10:49
The short answer
The correct way to go from C:\...\Adminto D:\Docs\Java drive, is the following command :
cd /d d:\Docs\JavaMore details
If you're somewhere random on your D:\ drive, and you want to go to the root of your drive, you can use this command :
cd d:\If you're somewhere random on your D:\ drive, and you want to go to a specific folder on your drive, you can use this command :
cd d:\Docs\JavaIf you're on a different drive, and you want to go to the root of your D:\ drive, you can use this command :
cd /d d:\If you're on a different drive, and you want to go to a specific folder on your D: drive, you can use this command :
cd /d d:\Docs\JavaIf you're on a different drive, and you want to go to the last open folder of you D: drive, you can use this command :
cd /d d:As a shorthand for cd /d d:, you can also use this command :
d: Share Improve this answer Follow answered Jul 8, 2017 at 11:08 John SlegersJohn Slegers 47k23 gold badges203 silver badges172 bronze badges 3- 2 Also, if you try switching to a network drive, my workaround was to go into the drive from Solution Explorer and type cmd on the address bar. That opens it up – Artorias2718 Commented Feb 26, 2019 at 18:28
- For some reason, none of the ways worked for me except the shorthand method listed at the end. – 9Deuce Commented Aug 26, 2020 at 19:43
- @Artorias2718 Not the same thing but if you "shift+R_click" inside the folder you will have the option to open a terminal there. I have Powershell and WLS avaliable, if you need cmd you can type "cmd" and hit enter in the Powershell prompt. – dmb Commented Jan 6, 2023 at 19:15
you should use a /d before path as below :
cd /d e:\ Share Improve this answer Follow answered Dec 6, 2017 at 16:01 Abolfazl MiadianAbolfazl Miadian 3,1592 gold badges20 silver badges15 bronze badges 1- thanks this worked.. what is /d for? – rishi jain Commented Jun 12, 2023 at 12:46
In order to move to D drive in windows use,
C:\Users\Balaji>d:In order to move to E drive use,
C:\Users\Balaji>e:same will be applicable for other drives.
Share Improve this answer Follow edited Aug 11, 2022 at 18:20 StayOnTarget 12.9k11 gold badges59 silver badges105 bronze badges answered Jul 11, 2019 at 6:45 Balaji DinakaranBalaji Dinakaran 3752 silver badges8 bronze badges Add a comment | 10If you want to change from current working directory to another directory then in the command prompt you need to type the name of the drive you need to change to, followed by : symbol. example: assume that you want to change to D-drive and you are in C-drive currently, then type D: and hit Enter.
On the other hand if you wish to change directory within same working directory then use cd(change directory) command followed by directory name. example: assuming you wish to change to new folder then type: cd "new folder" and hit enter.
Tips to use CMD: Windows command line are not case sensitive. When working with a file or directory with a space, surround it in quotes. For example, My Documents would be "My Documents". When a file or directory is deleted in the command line, it is not moved into the Recycle bin. If you need help with any of command type /? after the command. For example, dir /? would give the options available for the dir command.
Share Improve this answer Follow answered Sep 25, 2013 at 11:50 VinayakVinayak 1211 silver badge4 bronze badges Add a comment | 6You can change directory using this command like : currently if you current working directoris c:\ drive the if you want to go to your D:\ drive then type this command
cd /d D:\now your current working directory is D:\ drive so you want go to Java directory under Docs so type below command :
cd Docs\Javanote : d stands for drive
Share Improve this answer Follow answered Mar 30, 2017 at 7:05 Hoque MD ZahidulHoque MD Zahidul 11.9k2 gold badges41 silver badges42 bronze badges Add a comment | 5If you want to jump from C: Drive to any drive just type the drive name with colon like (E:) in Anaconda and Enter, Anaconda redirect you in that E:Drive.
Now take the folder path and use cd .\<<Folder_Path>> and then Enter.
I have put the screenshots for your reference:
Share Improve this answer Follow answered Nov 23, 2022 at 7:58 Ajeet VermaAjeet Verma 1,1231 gold badge9 silver badges27 bronze badges Add a comment | 4The cd command on Windows is not intuitive for users of Linux systems. If you expect cd to go to another directory no matter whether it is in the current drive or another drive, you can create an alias for cd. Here is how to do it in Cmder:
- Go to $CMDER_ROOT/config and open the file user_aliases.cmd
- Add the following to the end of the file:
Restart Cmder and you should be able to cd to any directory you want. It is a small trick but works great and saves your time.
Share Improve this answer Follow edited Mar 27, 2019 at 12:24 Nigel Thorne 21.5k3 gold badges37 silver badges52 bronze badges answered Feb 1, 2019 at 11:40 jdhaojdhao 28.1k22 gold badges153 silver badges314 bronze badges Add a comment | 4An easier way is to use PowerShell instead, that not require any additionnal flag:
W:\> cd C:\path\on\different\disk Share Improve this answer Follow answered Apr 28, 2021 at 7:45 DevMultiTechDevMultiTech 3723 silver badges16 bronze badges Add a comment | 3you can use help on command prompt on cd command by writing this command cd /? as shown in this figure
Share Improve this answer Follow answered Aug 26, 2018 at 21:53 Mohammed AwneyMohammed Awney 1,3141 gold badge17 silver badges21 bronze badges Add a comment | 2I suppose you are using Windows system.
Once you open CMD you would be shown with the default location i.e. like this
C:\Users\Admin - In your case its admin as mentioned else it will be the username of your computer
Consider if you want to move to E directory then simply type E:
This will move the user to E: Directory. Now change to what ever folder you want to point to in E: Drive
Ex: If you want to move to Software directory of E folder then first type
E:
then type the location of the folder
cd E:\Software
Viola
Share Improve this answer Follow answered Feb 24, 2017 at 9:12 user2401863user2401863 1048 bronze badges Add a comment | 1Long story short:
While it indeed has been cd driveletter:\ before (e.g. cd d:\),
in Windows 10, it's driveletter:\ only (e.g. d:).
Share Improve this answer Follow answered Nov 28, 2022 at 22:02 Giorgi TsiklauriGiorgi Tsiklauri 11k9 gold badges53 silver badges81 bronze badges Add a comment | Highly active question. Earn 10 reputation (not counting the association bonus) in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity.Not the answer you're looking for? Browse other questions tagged
or ask your own question.- The Overflow Blog
- Legal advice from an AI is illegal
- Why do developers love clean code but hate writing documentation?
- Featured on Meta
- The December 2024 Community Asks Sprint has been moved to March 2025 (and...
- Stack Overflow Jobs is expanding to more countries
Linked
2 Cant change directory in CMD, but Powershell works fine 554 Aliases in Windows command prompt 288 Generate C# class from XML 51 Anaconda / Python: Change Anaconda Prompt User Path 6 quarto_render broken from .bat / .cmd file 2 How do I change my current directory location from C drive to D drive in git bash -2 Change directory via cmd.exe doesn't work 0 How to change the build agent work location to other location from teamcity server 0 cannot create log file when running batch file in task scheduler 0 VBA Shell on remote connection See more linked questionsRelated
9 cmd defaults to F: drive 11 Command Prompt: Why do I get “cannot find the path specified” when I move a folder (with contents) from the desktop to a new directory? 269 how to change directory using Windows command line 0 Why do you need to change drives in cmd prompts? 0 Changing current directory to specified file directoy 2 cd command won't change directory. Comand prompt 0 Invoking "cmd.exe" and change "cd" to directory on mapped drive from C# app 2 To change drive and directory at the same time 0 I am not able to change the directory 2 I am unable to change the directory in cmdHot Network Questions
- Is the word "boy" racist in the following situation?
- What abbreviation for knots do pilots in non-English-speaking countries use?
- Can a triple product of characters be irreducible?
- Energy stored in EM fields are non-retrievable?
- Replication from VM on Hyper-V to VM on VMware
- I'm seeking a diplomatic answer to a question about Reform vs traditional customs re Kaddish Yatom
- Which philosopher developed the theoretical foundation of physicalism?
- Is it normal for cabinet nominees to meet with senators before hearings?
- Does Helldivers 2 still require a PSN account link on PC (Steam)?
- What's an Unethical Drug to Limit Anger in a Dystopic Setting
- Is this version of Zorn's lemma provable in ZF?
- adduser allows weak password - how to prevent?
- Why does the Apple II have the VERIFY command in DOS 3.3 and ProDOS?
- Are there actual correct representations of curved spacetime?
- Global Choice bi-interpretable with Global Wellorder?
- What is the difference between Open source and "Source available" software?
- polymorphic message container
- Is there an English equivalent of Arabic "gowatra" - performing a task with none of the necessary training?
- How can I cover fountain pen ink for wall paint?
- A sad-looking tree with a secret
- How to teach high school students to analyze diagrams in a proof?
- Is SQL Injection possible if we're using only the IN keyword (no equals = operator) and we handle the single quote
- PSE Advent Calendar 2024 (Day 18): A sweet & short expected chemistry Christmas puzzle
- Horror Film about a streamer convention set at a hotel where a tragedy had taken place
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Từ khóa » Cd Trong Cmd
-
Lệnh Cd Trong Windows
-
Cách Sử Dụng Câu Lệnh Cd Trong Cmd để Thay đổi Thư Mục - Lanit
-
Thay đổi đường Dẫn Trong CMD(Command Prompt) Trên Win10/Win11
-
Lệnh Chuyển ổ đĩa Trong CMD - Thủ Thuật Phần Mềm
-
How To Change Directories In Command Prompt: 8 Steps - WikiHow
-
Lệnh Cd Trong Cmd
-
Làm Thế Nào để Thay đổi Thư Mục Trong CMD. Cách Sử Dụng CD ...
-
Lệnh Cd Trong Cmd Để Thay Đổi Thư Mục ...
-
Lệnh Cd Trong Cmd - Đọc Thú Vị
-
Cách Thay đổi Thư Mục Trong CMD (Command Prompt) Trên Windows ...
-
Lệnh Cmd Hay Dùng Trong Windows
-
Cd (lệnh) – Wikipedia Tiếng Việt
-
Cách Thay đổi Thư Mục Trong CMD Trên Windows 10 - 101 Help