Recent

Author Topic: A funny thing about DOS  (Read 736 times)

TBMan

  • Sr. Member
  • ****
  • Posts: 334
A funny thing about DOS
« on: November 23, 2025, 05:15:51 pm »
So being a child of the 50's I thought I knew just about everything about maneuvering file folders using DOS. With this knowledge I was able to mimic the behavior of the chdir (cd) DOS command to change folders in my file open dialog. I was finishing up for the night and then I noticed that the ".." file entry was missing when I was one folder above the root.

I thought I screwed up.

So this morning I quickly did some research and also went into COMMAND and got into a folder, one above C: as in C:\folder. I typed "Dir /P" and sure enough there wasn't the old ".."

Now, at the C:\folder1 level you can type ".." and press enter to go to the root directory of "C:\", but the ".." isn't listed.

As part of my file dialog behavior, the path passed to the class method create has to have a "\" at the end of the path name. If it isn't there I add it. (My code does path+'*.*' to get all the folders into the file list and then does path+filemask to search for the specific file extension files to add to the list. )

It was a quick fix this morning to just do a
Code: Pascal  [Select][+][-]
  1. TimesInStr(C:char;ss:string):integer;
function that counts the "\" in the path string. If it is 2 then I just add ".." as the first directory in the file list.

Problem solved because when my code sees ".." as the selected item in the dialog and the "Chdir" button is clicked on, it will now bump the path up to the previous folder level  :)
« Last Edit: November 23, 2025, 05:18:02 pm by TBMan »
I love programming.


Newest game (clone),
Missile Commander:
https://www.youtube.com/watch?v=tgKz0cxog-k

creaothceann

  • Full Member
  • ***
  • Posts: 249
Re: A funny thing about DOS
« Reply #1 on: November 23, 2025, 09:48:56 pm »
I noticed that the ".." file entry was missing when I was one folder above the root.
Interesting, I also didn't know that.
EDIT: And it's really hard to come up with any search terms in Google that show relevant results.


As part of my file dialog behavior, the path passed to the class method create has to have a "\" at the end of the path name. If it isn't there I add it.
Btw. you can use IncludeTrailingPathDelimiter for that (in case you aren't already).


when my code sees ".." as the selected item in the dialog and the "Chdir" button is clicked on, it will now bump the path up to the previous folder level
What does it do with CON, PRN, AUX, NUL, etc.?
« Last Edit: November 23, 2025, 10:03:32 pm by creaothceann »

mika

  • Full Member
  • ***
  • Posts: 132
Re: A funny thing about DOS
« Reply #2 on: November 23, 2025, 09:56:09 pm »
So this morning I quickly did some research and also went into COMMAND and got into a folder, one above C: as in C:\folder. I typed "Dir /P" and sure enough there wasn't the old ".."
I do see ".." there.
MS DOS 6.22, FreeDOS 1.4, DosBox-x all show ".."

TBMan

  • Sr. Member
  • ****
  • Posts: 334
Re: A funny thing about DOS
« Reply #3 on: November 23, 2025, 10:59:02 pm »
So this morning I quickly did some research and also went into COMMAND and got into a folder, one above C: as in C:\folder. I typed "Dir /P" and sure enough there wasn't the old ".."
I do see ".." there.
MS DOS 6.22, FreeDOS 1.4, DosBox-x all show ".."

I'm using Windows 11. It's not there.
I love programming.


Newest game (clone),
Missile Commander:
https://www.youtube.com/watch?v=tgKz0cxog-k

dsiders

  • Hero Member
  • *****
  • Posts: 1509
Re: A funny thing about DOS
« Reply #4 on: November 23, 2025, 11:13:59 pm »
So this morning I quickly did some research and also went into COMMAND and got into a folder, one above C: as in C:\folder. I typed "Dir /P" and sure enough there wasn't the old ".."
I do see ".." there.
MS DOS 6.22, FreeDOS 1.4, DosBox-x all show ".."

I'm using Windows 11. It's not there.

I have a Win 11 laptop... and it is there. Perhaps it interacts with the File Explorer option to "Show Hidden Files". Mine's enabled.

TBMan

  • Sr. Member
  • ****
  • Posts: 334
Re: A funny thing about DOS
« Reply #5 on: November 23, 2025, 11:16:10 pm »
So this morning I quickly did some research and also went into COMMAND and got into a folder, one above C: as in C:\folder. I typed "Dir /P" and sure enough there wasn't the old ".."
I do see ".." there.
MS DOS 6.22, FreeDOS 1.4, DosBox-x all show ".."

I'm using Windows 11. It's not there.

I have a Win 11 laptop... and it is there. Perhaps it interacts with the File Explorer option to "Show Hidden Files". Mine's enabled.

Maybe, but it isn't there on mine. I do have the "Show hidden files" off, but the single dot does show. Here's a short video.

https://www.youtube.com/watch?v=73h9kZCD0d0


I love programming.


Newest game (clone),
Missile Commander:
https://www.youtube.com/watch?v=tgKz0cxog-k

speter

  • Sr. Member
  • ****
  • Posts: 467
Re: A funny thing about DOS
« Reply #6 on: November 23, 2025, 11:38:22 pm »
I am using windows 11 (with "show hidden files" on), and there is no "..".
Amazing that I never noticed this.

cheers
S.
I climbed mighty mountains, and saw that they were actually tiny foothills. :)

MKGilby

  • Newbie
  • Posts: 4
Re: A funny thing about DOS
« Reply #7 on: November 24, 2025, 03:06:00 pm »
Try "dir /A" it will be there. But still don't know why.

speter

  • Sr. Member
  • ****
  • Posts: 467
Re: A funny thing about DOS
« Reply #8 on: November 24, 2025, 10:57:27 pm »
I asked (windows) copilot the following:
Code: [Select]
when using CMD.EXE, if I change to c:\users then type "dir", the display includes "." but not "..", why is this?
its reply:
Code: [Select]
... In C:\Users, Windows intentionally hides .. because it’s a junction point (a type of reparse point).
Junction points explained:
- C:\Users is not just a normal folder; it’s a junction that redirects to the actual user profile directories.
- Junctions are used for backward compatibility and system organization.
- To avoid confusion or accidental navigation, Windows suppresses the .. entry in certain system directories like C:\Users.

Sadly, when I mentioned the c:\lazarus shows the same behavour, I lost interest in copilot's answers. :o

cheers
S.

I climbed mighty mountains, and saw that they were actually tiny foothills. :)

 

TinyPortal © 2005-2018