How do I navigate to a desktop in Windows CMD?


πŸ‘€Β Diwas Poudel Β Β  πŸ•’ 24 Feb 2023 Β Β  πŸ“ TECH

CMD is an acronym for Command Prompt officially known as Windows Command Processor. Geeks enjoy Command Prompt because it allows them to perform basic to complex administrative activities and fix various Windows issues.

You'll first learn why you want to navigate, how to navigate and change directories in the command prompt. The instructor might not show you how to get to your desktop while you're learning. As a result, I've arrived to assist you.

Why you want to navigate to desktop ?

You sometimes needs to navigate to desktop due to several reasons like :

  • Automating tasks : Users can write scripts that can execute various action on files and folder in desktop.Automating these tasks on the PC using the command prompt saves time.
  • Troubleshooting purpose:A user may need to use the command prompt to access to the desktop to run diagnostic or repair tools if their desktop or files are having issues.
  • Accessing hidden files and folders on desktop:File explorer may not show secret desktop files. Users can view and manipulate hidden files and folders on the desktop using the command prompt.

Users can write scripts or batch files to execute actions on desktop files and folders. Automating these tasks on the PC using the command prompt saves time.

When utilizing the command prompt to get to the desktop, it isn't always easy, and it can be difficult at times. I'll show you how to browse to a desktop in Windows CMD in this tutorial. Let's get started with the many ways to browse in Windows CMD without further ado.

Method 1: Using File Explorer (or Windows Explorer) and Command Prompt

We can easily navigate to the desktop with the help of File Explorer. File Explorer is a file management application that is included with the Windows Operating System that allows you to navigate files, folders, and drives present on your computer.

Note that Windows Explorer is not Internet Explorer.

Steps:

1 Goto File Explorer (Press Windows + E )

Alternatively, Type File Explorer in the search bar and click on 'File Explorer from the list

2 Navigate to the Desktop folder

3 Goto the top where it shows your location in the location bar (like the address bar in the browser), replace it with cmd, and press enter.

This will open a command prompt inside the current user's desktop.

Method 2: Using Drag & Drop and Command Prompt

In the command prompt, we can easily drag and drop folders and navigate to them directly.

Steps:

1 Open Command Prompt and type cdΒ 

2 Open File Explorer and Find Desktop icon.

3 Just drag and drop the Desktop icon and paste it in the already opened command prompt.and press Enter

This will navigate inside the desktop.

Method 3: Using Environment Variable and Command Prompt

An environment variable is simply a variable that stores a value. Some of the popular Environment variables are %userprofile%, %temp%, etc.

%userprofile% :%UserProfile% variable is a special system-wide environment variable holding user profile information. The path to your user profile folder is stored in the %userprofile% variable. It's a collection of settings associated with a certain user.

This folder contains the user's identification for operating systems, software, and websites. With the help of the %userprofile% environment variable, you can navigate to the desktop.

Note that %userprofile% is not the same as %username%

Steps:

1 Open Command Prompt andΒ 

2 Type

cd /d %userprofile%/desktop

It contains %SystemDrive%\Users\{username}\desktop.This will navigate you to the desktop.

Windows is case insensitive, so you only need to be aware of what you type and not how you type it. You can type Cd, CD, or cd. Use capital letters, lowercase, or any combination of them.

Also read: Navigate to Users folder from System32 in CmdΒ 

Method 4: Using Direct Method and command prompt

We know that the desktop path for a different version of the Windows operating system is a different path.

For Windows Vista, Windows 7, Windows 8, Windows 10, Windows 11 operating system, etc path is :

c:\Users\(username)\Desktop

For Windows 2000, 2003, and XP OS, the path is:

c:\documents and settings\(username)\desktop

For Windows 98, 95, and ME Operating System

c:\windows\desktop

Note: You can get your username by typing echo %username% in the command prompt.

Now, let's follow the below steps

  • Press Windows + R and type cmd.exe and press Enter
  • Then just type cd followed by the above command.

In my case, I am using Windows 11 and I will just type below:

cd c:\Users\rider\Desktop

where the rider is my username.

This will navigate to you directly inside the desktop path in the command prompt.Β 

Also read: How to sleep or wait in Windows batch file?Β 

Method 5: By Knowing Desktop Properties

By looking at desktop properties you will get the complete path of the desktop.

Steps:

1 Right-click on 'Desktop'

2 Click on Properties

3 Navigate to the Location tab

4 Then you will get the desktop folder path of the current login user and copy it.

5 Then open the command prompt and just type:

cd copiedtexthere

where copiedtexthere is a text you have just copied

This will open your desktop path in the command prompt in the next line.

Also read: Create an Empty file at Windows Command Line

Conclusion:

By pressing the Win + D keys, you can quickly navigate to the desktop. You can also get to the desktop by pressing the Win + M key while minimizing all open programs. However, when working with batch programming and CMD, you may want to navigate to the desktop, and there are several ways to do so which are listed above.

Overall, using the command prompt to navigate to the desktop gives users more freedom and control over their computer and its files, and can be particularly useful for advanced users or system admins.

Β 

Β