{"id":4094,"date":"2026-02-18T13:07:47","date_gmt":"2026-02-18T13:07:47","guid":{"rendered":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/?p=4094"},"modified":"2026-03-27T11:10:24","modified_gmt":"2026-03-27T11:10:24","slug":"how-to-change-directory-in-command-prompt","status":"publish","type":"post","link":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/493\/change-directory-in-command-prompt.html","title":{"rendered":"How to Change Directory in Command Prompt?"},"content":{"rendered":"\n<p>Imagine trying to open a file in Command Prompt but getting an error every time. This isn&#8217;t because the file doesn\u2019t exist; it&#8217;s because you are in the wrong folder.<\/p>\n\n\n\n<p>That\u2019s exactly how Command Prompt works. Before you run a program, access a file, or execute a script, you must first navigate to the correct directory. If you don\u2019t know how to move between folders properly, many commands simply won\u2019t work.<\/p>\n\n\n\n<p>In Windows, changing directories is done using the <strong>cd<\/strong> <strong>(Change Directory)<\/strong> command. But it\u2019s not just about typing <strong>cd<\/strong> foldername.<\/p>\n\n\n\n<p><strong>There are different situations:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2605';\">\n\n<li>&nbsp;Moving inside a folder<\/li>\n\n\n<li>&nbsp;Jumping to a completely different path<\/li>\n\n\n<li>&nbsp;Switching drives (C: to D:)<\/li>\n\n\n<li>&nbsp;Going back to the previous folder<\/li>\n\n\n<li>&nbsp;Accessing folders with spaces in their names<\/li>\n\n<\/ul>\n\n\n\n<p>In this article, you will learn each method clearly with proper step-by-step processes and practical examples, so you can confidently navigate through Command Prompt without confusion.<\/p>\n\n\n\n<p><hr><p><strong>Also Read: <\/strong><a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/489\/create-file-in-windows-cmd.html\"><strong>How to Create a File in Command Prompt?<\/strong><\/a><\/p><hr><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Understanding the cd Command<\/strong><\/h2>\n\n\n\n<p>The main command used to change directories is:<\/p>\n\n\n\n<p><figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>cd<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure><\/p>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2605';\">\n\n<li>&nbsp;<strong>cd<\/strong> means Change Directory. It tells the Command Prompt to move from your current location to another folder.<\/li>\n\n<\/ul>\n\n\n\n<p>Before changing directories, it\u2019s quite important to know where you currently are.<\/p>\n\n\n\n<p><strong>To know this, follow these steps:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n\n<li>&nbsp;Type the following command &amp; press<strong> \u2018Enter\u2019<\/strong>:<br><br><figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>cd<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure><\/li>\n\n\n<li>&nbsp;You will see something like:<br><br><figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>C:\\Users\\yourcurrentdirectory<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure><\/li>\n\n<\/ul>\n\n\n\n<p>This is your current directory!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Methods to Change Directory in Command Prompt<\/strong><\/h2>\n\n\n\n<p>There are a few methods to change the directory in the Command Prompt. Let\u2019s understand each &amp; every method:<\/p>\n\n\n\n<p><hr><strong>Also Read: <\/strong><a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/488\/check-folder-permission-in-windows-cmd.html\"><strong>How to Check Folder Permission in Windows CMD?<\/strong><\/a><hr><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u27a2<strong>&nbsp;Method 1: Change Directory to a Folder Inside the Current Folder<\/strong><\/h3>\n\n\n\n<p>You can use this method when the folder you want to enter is inside your current directory.<\/p>\n\n\n\n<p><strong>For Example:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n\n<li>&nbsp;In the given situation, your current directory is:<br><br><figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>C:\\Users\\yourdirectory<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure><\/li>\n\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2605';\">\n\n<li>&nbsp;Here, <strong style=\"font-family: Consolas, monospace !important;font-size: 18px;\">yourdirectory<\/strong> refers to your directory name.<\/li>\n\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n\n<li>&nbsp;You want to go to:<br><br><figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>Documents<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure><\/li>\n\n<\/ul>\n\n\n\n<p><strong>Step-by-Step Process:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n\n<li style=\"margin: 10px 0;\">&nbsp;Open Command Prompt.<\/li>\n\n\n<li style=\"margin: 10px 0;\">&nbsp;Firstly, you have to confirm your location using:<br><br><figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>cd<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure><\/li>\n\n\n<li>&nbsp;In that, type &amp; press<strong> \u2018Enter.\u2019<\/strong><br><br><figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>cd Documents<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure><\/li>\n\n\n<li style=\"margin: 10px 0;\">&nbsp;Now, you have to check the location again using the <strong>\u2018cd\u2019<\/strong> command:<\/li>\n\n\n<li style=\"margin: 10px 0;\">&nbsp;You will now see:<br><br><figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>C:\\Users\\yourdirectory\\Documents<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure><\/li>\n\n<\/ul>\n\n\n\n<p>That\u2019s it! You have successfully entered the Documents folder!<\/p>\n\n\n\n<p><hr><strong>Also Read: <\/strong><a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/479\/check-laravel-version-windows-cmd.html\"><strong>How to Check Laravel Version in Windows CMD?<\/strong><\/a><hr><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Method 2: Change Directory Using Full Path<\/strong><\/h3>\n\n\n\n<p>You can use this method when the folder is not inside your current directory.<\/p>\n\n\n\n<p>This method works from anywhere!<\/p>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n\n<li>&nbsp;If you want to go directly to:<br><br><figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>C:\\Users\\yourdirectory\\Downloads<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure><\/li>\n\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2605';\">\n\n<li>&nbsp;Here, <strong style=\"font-family: Consolas, monospace !important;font-size: 18px;\">yourdirectory<\/strong> refers to your directory name.<\/li>\n\n<\/ul>\n\n\n\n<p><strong>Step-by-Step Process:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n\n<li style=\"margin: 10px 0;\">&nbsp;Open Command Prompt.<\/li>\n\n\n<li style=\"margin: 10px 0;\">&nbsp;Here, you have to type the complete path:<br><br><figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>cd C:\\Users\\yourdirectory\\Downloads<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure><\/li>\n\n\n<li style=\"margin: 10px 0;\">&nbsp;After typing, press <strong>\u2018Enter.\u2019<\/strong><\/li>\n\n\n<li style=\"margin: 10px 0;\">&nbsp;Now, you have to verify using the <strong>\u2018cd\u2019<\/strong> command:<\/li>\n\n<\/ul>\n\n\n\n<p>You are now inside the Downloads folder!<\/p>\n\n\n\n<p>This method avoids moving through each folder step by step.<\/p>\n\n\n\n<p><hr><p><strong>Also Read: <\/strong><a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/474\/check-sql-version-in-windows-cmd.html\"><strong>How to Check the SQL Version in Windows CMD?<\/strong><\/a><\/p><hr><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Method 3: Change Drive and Directory at the Same Time<\/strong><\/h3>\n\n\n\n<p>Before understanding this method, you need to know one important thing:<\/p>\n\n\n\n<p>In Command Prompt, changing a directory and changing a drive are two different actions.<\/p>\n\n\n\n<p><strong>For Example:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2605';\">\n\n<li>&nbsp;<strong>C: is one drive<\/strong><\/li>\n\n\n<li>&nbsp;<strong>D: is another drive<\/strong><\/li>\n\n<\/ul>\n\n\n\n<p>If you are currently working in the <strong>C: drive<\/strong> and try to move directly to a folder on the <strong>D: drive<\/strong>, Command Prompt will not automatically switch drives unless you tell it to.<\/p>\n\n\n\n<p>That\u2019s where many users get confused.<\/p>\n\n\n\n<p>To change both the drive and the directory at the same time, use <strong>\/d<\/strong>.<\/p>\n\n\n\n<p><strong>For Example:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n\n<li>&nbsp;Your current location is:<br><br><figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>C:\\Users\\yourdirectory<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure><\/li>\n\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2605';\">\n\n<li>&nbsp;Here, <strong style=\"font-family: Consolas, monospace !important;font-size: 18px;\">yourdirectory<\/strong> refers to your directory name.<\/li>\n\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n\n<li>&nbsp;Your target location is:<br><br><figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>D:\\Projects<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure><\/li>\n\n<\/ul>\n\n\n\n<p><strong>Step-by-Step Process:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n\n<li>&nbsp;In CMD, you have to type the below command &amp; press <strong>\u2018Enter\u2019<\/strong>:<br><br><figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>cd \/d D:\\Projects<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure><\/li>\n\n\n<li>&nbsp;Now, you have to check the location using the<strong> \u2018cd\u2019 <\/strong>command:<\/li>\n\n<\/ul>\n\n\n\n<p><strong>Now you will see:<\/strong><\/p>\n\n\n\n<p><figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>D:\\Projects<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure><\/p>\n\n\n\n<p><hr><strong>Also Read: <\/strong><a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/468\/check-angular-version-in-windows-cmd.html\"><strong>How to Check Angular Version in Windows CMD?<\/strong><\/a><hr><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u27a2<strong>&nbsp;Method 4: Move One Level Up (Go Back)<\/strong><\/h3>\n\n\n\n<p>Sometimes, if you need to go back to the parent folder, you can use this method.<\/p>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n\n<li>&nbsp;You have to use:<br><br><figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>cd ..<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure><\/li>\n\n<\/ul>\n\n\n<p><strong>Example:<\/strong><\/p>\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n<li>&nbsp;If your current location is:<br \/>\n<figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span><\/p>\n<table class=\"has-fixed-layout\">\n<tbody>\n<tr>\n<td class=\"kb_firewall\"><strong>C:\\Users\\yourdirectory\\Documents<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<\/li>\n<\/ul>\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2605';\">\n\n\n<li>&nbsp;Here, <strong style=\"font-family: Consolas, monospace !important;font-size: 18px;\">yourdirectory<\/strong> refers to your directory name.<\/li>\n\n\n<\/ul>\n<p><strong>Process to do this:<\/strong><\/p>\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n<li>&nbsp;Type the following command &#038; press<strong>\u2018Enter\u2019:<\/strong><br \/>\n<figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span><\/p>\n<table class=\"has-fixed-layout\">\n<tbody>\n<tr>\n<td class=\"kb_firewall\"><strong><br \/>\ncd ..<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<\/li>\n<li style=\"margin: 10px 0;\">&nbsp;Now, you have to check the location with the <strong>\u2018cd\u2019<\/strong> command:<\/li>\n<li style=\"margin: 10px 0;\">&nbsp;The New location will be:<br \/>\n<figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span><\/p>\n<table class=\"has-fixed-layout\">\n<tbody>\n<tr>\n<td class=\"kb_firewall\"><strong>C:\\Users\\yourdirectory<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<\/li>\n<\/ul>\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2605';\">\n<li>&nbsp;Each .. moves you one level up.<\/li>\n<\/ul>\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n<li>&nbsp;To move two levels up:<br \/>\n<figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span><\/p>\n<table class=\"has-fixed-layout\">\n<tbody>\n<tr>\n<td class=\"kb_firewall\"><strong>cd ..\\..<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<\/li>\n<\/ul>\n\n\n<p><hr><p><strong>Also Read: <\/strong><a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/465\/check-php-version-in-windows-cmd.html\"><strong>Guide to Check PHP Version in Windows CMD<\/strong><\/a><\/p><hr><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u27a2<strong>&nbsp;Method 5: Go Directly to Root Directory<\/strong><\/h3>\n\n\n\n<p>The root directory is the main folder of a drive.<\/p>\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n<li>&nbsp;To go to the root:<br \/>\n<figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span><\/p>\n<table class=\"has-fixed-layout\">\n<tbody>\n<tr>\n<td class=\"kb_firewall\"><strong>cd \\<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<\/li>\n<\/ul>\n<p><strong>Example:<\/strong><\/p>\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n<li>&nbsp;The Current location is:<br \/>\n<figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span><\/p>\n<table class=\"has-fixed-layout\">\n<tbody>\n<tr>\n<td class=\"kb_firewall\"><strong>C:\\Users\\yourdirectory\\Documents<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<\/li>\n<\/ul>\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2605';\">\n<li>&nbsp;Here, <strong style=\"font-family: Consolas, monospace !important;font-size: 18px;\">yourdirectory<\/strong> refers to your directory name.<\/li>\n<\/ul>\n<p><strong>Process to do this:<\/strong><\/p>\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n<li>&nbsp;Firstly, you have to type &#038; press <strong>\u2018Enter\u2019:<\/strong><br \/>\n<figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span><\/p>\n<table class=\"has-fixed-layout\">\n<tbody>\n<tr>\n<td class=\"kb_firewall\"><strong>cd \\<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<\/li>\n<li style=\"margin: 10px 0;\">&nbsp;After that, you have to check the location with the <strong>\u2018cd\u2019<\/strong> Command:<\/li>\n<li style=\"margin: 10px 0;\">&nbsp;You will be at a new location:<br \/>\n<figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span><\/p>\n<table class=\"has-fixed-layout\">\n<tbody>\n<tr>\n<td class=\"kb_firewall\"><strong>C:\\<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<\/li>\n<\/ul>\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2605';\">\n<li>&nbsp;You are now at the top level of the drive.<\/li>\n<\/ul>\n\n\n<p><hr><p><strong>Also Read: <\/strong><a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/464\/check-node-version-in-windows-cmd.html\"><strong>Guide to Check Node Version in Windows CMD<\/strong><\/a><\/p><hr><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u27a2<strong>&nbsp;Method 6: Change Directory When Folder Name Has Spaces<\/strong><\/h3>\n\n\n\n<p>If a folder name contains spaces, you must use double quotes.<\/p>\n\n\n\n<p><strong>Example Folder:<\/strong><\/p>\n\n\n<figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span><\/p>\n<table class=\"has-fixed-layout\">\n<tbody>\n<tr>\n<td class=\"kb_firewall\"><strong><strong>Program Files<\/strong><\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p><strong>Incorrect Command:<\/strong><\/p>\n<figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span><\/p>\n<table class=\"has-fixed-layout\">\n<tbody>\n<tr>\n<td class=\"kb_firewall\"><strong><strong>cd Program Files<\/strong><\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2605';\">\n<li style=\"color: red;\">&nbsp;<strong>This will give an error.<\/strong><\/li>\n<\/ul>\n<p><strong>Correct Process to do this:<\/strong><\/p>\n<p>You have to always use quotes for folder names with spaces.<\/p>\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n<li>&nbsp;You have to type the command &#038; press <strong>\u2018Enter\u2019:<\/strong><br \/>\n<figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span><\/p>\n<table class=\"has-fixed-layout\">\n<tbody>\n<tr>\n<td class=\"kb_firewall\"><strong><strong>cd &#8220;Program Files&#8221;<\/strong><\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<\/li>\n<\/ul>\n<p style=\"text-align: center;\"><strong>OR<\/strong><\/p>\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2794';\">\n<li>&nbsp;If you are using a full path, run the command:<br \/>\n<figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span><\/p>\n<table class=\"has-fixed-layout\">\n<tbody>\n<tr>\n<td class=\"kb_firewall\"><strong><strong>cd &#8220;C:\\Program Files&#8221;<\/strong><\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<\/li>\n<\/ul>\n\n\n<h2 class=\"wp-block-heading\"><strong>Useful Supporting Command: dir<\/strong><\/h2>\n\n\n\n<p>Before changing directories, you can list folders using:<\/p>\n\n\n\n<p><figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n<table class=\"has-fixed-layout\">\n<tbody>\n<tr>\n<td class=\"kb_firewall\"><strong><strong>dir<\/strong><\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure><\/p>\n\n\n<p>This shows all files and folders in your current location. It helps confirm the correct folder name.<\/p>\n\n\n<p><hr><p><strong>Also Read: <\/strong><a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/433\/locating-and-editing-host-file-in-windows.html\"><strong>A Guide To Locating &amp; Editing a Host File in Windows<\/strong><\/a><\/p><hr><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Quick Command Reference<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\">\n    <table class=\"has-fixed-layout\" style=\"color: #6161ff;\">\n        <tbody>\n            <tr>\n                <td class=\"has-text-align-left\" data-align=\"left\"><strong>Task<\/strong><\/td>\n                <td><strong>Command<\/strong><\/td>\n            <\/tr>\n            <tr>\n                <td class=\"has-text-align-left\" data-align=\"left\">Enter folder<\/td>\n                <td><strong style=\"font-family: Consolas, monospace !important;font-size: 18px;\">cd foldername<\/strong><\/td>\n            <\/tr>\n            <tr>\n                <td class=\"has-text-align-left\" data-align=\"left\">Use the full path<\/td>\n                <td><strong style=\"font-family: Consolas, monospace !important;font-size: 18px;\">cd C:\\path\\folder<\/strong><\/td>\n            <\/tr>\n            <tr>\n                <td class=\"has-text-align-left\" data-align=\"left\">Change drive &amp; directory<\/td>\n                <td><strong style=\"font-family: Consolas, monospace !important;font-size: 18px;\">cd \/d D:\\folder<\/strong><\/td>\n            <\/tr>\n            <tr>\n                <td class=\"has-text-align-left\" data-align=\"left\">Move one level up<\/td>\n                <td><strong style=\"font-family: Consolas, monospace !important;font-size: 18px;\">cd ..<\/strong><\/td>\n            <\/tr>\n            <tr>\n                <td class=\"has-text-align-left\" data-align=\"left\">Go to the root<\/td>\n                <td><strong style=\"font-family: Consolas, monospace !important;font-size: 18px;\">cd \\<\/strong><\/td>\n            <\/tr>\n            <tr>\n                <td class=\"has-text-align-left\" data-align=\"left\">Folder with spaces<\/td>\n                <td><strong style=\"font-family: Consolas, monospace !important;font-size: 18px;\">cd &#8220;Folder Name&#8221;<\/strong><\/td>\n            <\/tr>\n            <tr>\n                <td class=\"has-text-align-left\" data-align=\"left\">Show current directory<\/td>\n                <td><strong style=\"font-family: Consolas, monospace !important;font-size: 18px;\">cd<\/strong><\/td>\n            <\/tr>\n            <tr>\n                <td class=\"has-text-align-left\" data-align=\"left\">List folders<\/td>\n                <td><strong style=\"font-family: Consolas, monospace !important;font-size: 18px;\">dir<\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p><hr><p><strong>Also Read: <\/strong><a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/426\/telnet-command-in-windows.html\"><strong>What is Telnet Command in Windows &amp; How to Use it?<\/strong><\/a><\/p><hr><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>Changing directories in Command Prompt is not complicated, but doing it correctly is essential. Every command you run depends on your current location. If you are in the wrong directory, even the correct command will fail.<\/p>\n\n\n\n<p><strong>By understanding how to:<\/strong><\/p>\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\2605';\">\n<li>&nbsp;Move inside folders<\/li>\n<li>&nbsp;Jump using full paths<\/li>\n<li>&nbsp;Switch drives<\/li>\n<li>&nbsp;Go back to parent folders<\/li>\n<li>&nbsp;Handle folder names with spaces<\/li>\n<\/ul>\n<p>You gain complete control over navigation in Command Prompt!<\/p>\n<p>Practice these methods a few times, and directory navigation will become second nature. Once you master this, working with files, programs, and scripts in Command Prompt becomes much easier and more powerful.<\/p>\n\n\n<script>\nfunction copyCommand(btn) {\n  const td = btn.parentElement.querySelector(\"td.kb_firewall\");\n  const text = td.innerText.trim();\n\n  navigator.clipboard.writeText(text).then(() => {\n    const msg = btn.parentElement.querySelector(\".copy-msg\");\n    msg.style.display = \"inline-block\";\n    setTimeout(() => msg.style.display = \"none\", 1000);\n  });\n}\n<\/script>\n\n\n","protected":false},"excerpt":{"rendered":"<p>Imagine trying to open a file in Command Prompt but getting an error every time. This isn&#8217;t because the file doesn\u2019t exist; it&#8217;s because you are in the wrong folder. That\u2019s exactly how Command Prompt works. Before you run a program, access a file, or execute a script, you must first navigate to the correct [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[],"class_list":["post-4094","post","type-post","status-publish","format-standard","hentry","category-vps"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Change Directory in Command Prompt?<\/title>\n<meta name=\"description\" content=\"Learn to change the directory in Windows Command Prompt using simple methods with our step-by-step guide, with clear examples to navigate folders quickly.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/493\/change-directory-in-command-prompt.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Change Directory in Command Prompt?\" \/>\n<meta property=\"og:description\" content=\"Learn to change the directory in Windows Command Prompt using simple methods with our step-by-step guide, with clear examples to navigate folders quickly.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/493\/change-directory-in-command-prompt.html\" \/>\n<meta property=\"og:site_name\" content=\"Host IT Smart Knowledge base\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-18T13:07:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-27T11:10:24+00:00\" \/>\n<meta name=\"author\" content=\"Admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/493\/change-directory-in-command-prompt.html\",\"url\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/493\/change-directory-in-command-prompt.html\",\"name\":\"How to Change Directory in Command Prompt?\",\"isPartOf\":{\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#website\"},\"datePublished\":\"2026-02-18T13:07:47+00:00\",\"dateModified\":\"2026-03-27T11:10:24+00:00\",\"author\":{\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/317c14a877385667f19d3b7496bd5108\"},\"description\":\"Learn to change the directory in Windows Command Prompt using simple methods with our step-by-step guide, with clear examples to navigate folders quickly.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/493\/change-directory-in-command-prompt.html\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#website\",\"url\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/\",\"name\":\"Host IT Smart Knowledge base\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/317c14a877385667f19d3b7496bd5108\",\"name\":\"Admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d4827c56a6721070dde339640d47ff44ba0d0e515c7e577cf29305ab72383fe3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d4827c56a6721070dde339640d47ff44ba0d0e515c7e577cf29305ab72383fe3?s=96&d=mm&r=g\",\"caption\":\"Admin\"},\"sameAs\":[\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/\"],\"url\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Change Directory in Command Prompt?","description":"Learn to change the directory in Windows Command Prompt using simple methods with our step-by-step guide, with clear examples to navigate folders quickly.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/493\/change-directory-in-command-prompt.html","og_locale":"en_US","og_type":"article","og_title":"How to Change Directory in Command Prompt?","og_description":"Learn to change the directory in Windows Command Prompt using simple methods with our step-by-step guide, with clear examples to navigate folders quickly.","og_url":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/493\/change-directory-in-command-prompt.html","og_site_name":"Host IT Smart Knowledge base","article_published_time":"2026-02-18T13:07:47+00:00","article_modified_time":"2026-03-27T11:10:24+00:00","author":"Admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Admin","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/493\/change-directory-in-command-prompt.html","url":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/493\/change-directory-in-command-prompt.html","name":"How to Change Directory in Command Prompt?","isPartOf":{"@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#website"},"datePublished":"2026-02-18T13:07:47+00:00","dateModified":"2026-03-27T11:10:24+00:00","author":{"@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/317c14a877385667f19d3b7496bd5108"},"description":"Learn to change the directory in Windows Command Prompt using simple methods with our step-by-step guide, with clear examples to navigate folders quickly.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/493\/change-directory-in-command-prompt.html"]}]},{"@type":"WebSite","@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#website","url":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/","name":"Host IT Smart Knowledge base","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/317c14a877385667f19d3b7496bd5108","name":"Admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d4827c56a6721070dde339640d47ff44ba0d0e515c7e577cf29305ab72383fe3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d4827c56a6721070dde339640d47ff44ba0d0e515c7e577cf29305ab72383fe3?s=96&d=mm&r=g","caption":"Admin"},"sameAs":["https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/"],"url":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/posts\/4094","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/comments?post=4094"}],"version-history":[{"count":48,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/posts\/4094\/revisions"}],"predecessor-version":[{"id":4148,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/posts\/4094\/revisions\/4148"}],"wp:attachment":[{"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/media?parent=4094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/categories?post=4094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/tags?post=4094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}