dir / ls not displaying files outside of root directory in Windows 10

0

I've been trying to point to files and directories via my command line or powershell in windows, but for whatever reason the dir or ls command will not display files or folders within the directory outside of the root directory. To demonstrate:

Here it works fine

Here is my Desktop in the GUI

But here is my Desktop again in the command line

How can I fix this so that files are displayed again?

Negimaki

Posted 2018-12-28T02:05:39.460

Reputation: 3

Your second image (File Explorer?) says that it is displaying OneNote > Desktop.    Have you tried dir OneNote\Desktop?   Or cd OneNote followed by dir Desktop? – Scott – 2018-12-28T02:48:17.423

Answers

1

The files you see on your desktop in the GUI are probably in the default profile. These icons will be visible for all users of the machine, but don't exist in the individual users' desktop folder.

Two tests you could do to confirm this...

Create a new file on your desktop, then re-run dir and confirm that it is visible.

Within the command prompt, change to the default profile directory by runnning the commands:

cd c:\Users\default\desktop
dir

Which should show the items in your original GUI screencap.

v25

Posted 2018-12-28T02:05:39.460

Reputation: 176

@n8te My understanding was that shortcuts should appear as .lnk files, and lack of them in screen cap #3 but visibility in the GUI would suggest they are located somewhere else. Has this changed in Windows 10? – v25 – 2018-12-28T02:31:42.483

You're right. My mistake. – n8te – 2018-12-28T02:34:06.837

If I make a new directory or file in cmd, it will show up on subsequent dir commands in said directory, but anything pre-existing it does not.

Nothing shows up in the “default” desktop directory you mentioned, either – Negimaki – 2018-12-28T03:03:52.407

1@negimaki try c:\Users\Public\Desktop instead? Or infact, further to what Scott pointed out in another comment, these shortcuts you see may exisit in C:\Users\[Your User Account Name]\OneDrive\Desktop – v25 – 2018-12-28T03:09:02.253

Weird. That last command DID work with cd and then for, but Desktop did not show up under dir. Hidden directories? Is this normal functioning? – Negimaki – 2018-12-28T03:12:02.063

^ edited my last comment. These could be under oneDrive's location as per screencap. – v25 – 2018-12-28T03:14:01.730

You were right. It was all under Onedrive. Not particularly intuitive, but reassuring. I thought I had somehow broken the command line at a system level! – Negimaki – 2018-12-28T03:19:21.090

@Negimaki BTW if you use the TAB key when navigating around directories it will auto-complete valid file/directory names, and also works on partial names so you can type cd o<tab> which should change the command to cd onedrive. This saves time, good luck ;) – v25 – 2018-12-28T03:25:36.683