Skip to content

Customising the Filesystem

Retro Jack edited this page Mar 26, 2026 · 20 revisions

Customising the Filesystem

The virtual filesystem is defined in prompt/index.html as a JavaScript array called fs. Everything — drives, directories, and files — lives in this one structure. No server or database required.

Finding the Filesystem

Open prompt/index.html and search for:

var fs = [{

Everything between that line and the closing }]; is the filesystem.


Adding a Link File

Link files open a URL in a new tab when executed.

Find the directory you want to add to and add a new entry to its files array:

{ name: 'GITHUB.COM', link: 'https://github.com/yourname' }

Example — adding a new emulator to C:\EMULATORS\DOS:

{
    name: 'DOS',
    directories: [
        ...
        { name: 'QUAKE', directories: [], files: [{ name: 'quake.exe', link: 'https://archive.org/details/quake106' }] },  // added
    ],
    files: [...]
}

The user can then cd\emulators\dos\quake and type quake to launch it.


Adding a Batch File

Batch files run a sequence of commands when executed. Commands are separated by \n.

{ name: 'HELLO.BAT', data: 'echo off\nsetcol 2e\necho Hello, world!\nsetcol 07\necho on' }

Supported batch commands: echo, echo off/on, cls, cd, dir, setcol, and any filename that exists in the current directory.

Example — a batch file that navigates and lists a directory:

{ name: 'GAMES.BAT', data: 'cls\ncd\\GAMES\ndir/w/o\n' }

Adding a Directory

Add an entry to the directories array of the parent directory:

{
    name: 'MUSIC',
    directories: [],
    files: [
        { name: 'SPOTIFY.COM', link: 'https://open.spotify.com/...' },
        { name: 'BANDCAMP.COM', link: 'https://yourname.bandcamp.com' }
    ]
}

Example — adding a C:\EMULATORS\ARCADE platform directory:

var fs = [{
    name: 'c',
    directories: [
        { name: 'LGR',       ... },
        { name: 'EMULATORS', directories: [
            { name: 'DOS',    ... },
            {                           // added
                name: 'ARCADE',
                directories: [],
                files: [
                    { name: 'mame.exe',    link: 'https://archive.org/details/...' },
                    { name: 'pacman.exe',  link: 'https://archive.org/details/...' }
                ]
            }
        ], files: [...] }
    ],
    ...
}];

The user can then type cd\emulators\arcade and dir to browse it.


Adding Nested Subdirectories

Directories can be nested to any depth. Each directory object has its own directories array — just keep nesting.

Structure:

{
    name: 'PARENT',
    directories: [
        {
            name: 'CHILD',
            directories: [
                {
                    name: 'GRANDCHILD',
                    directories: [],
                    files: [
                        { name: 'DEEP.COM', link: 'https://example.com' }
                    ]
                }
            ],
            files: [
                { name: 'CHILD.COM', link: 'https://example.com' }
            ]
        }
    ],
    files: [
        { name: 'PARENT.COM', link: 'https://example.com' }
    ]
}

The user navigates into nested directories exactly like real DOS:

cd\parent
cd child
cd grandchild

Or in one step using an absolute path:

cd\parent\child\grandchild

Example — a C:\GAMES tree with genre subdirectories:

{
    name: 'GAMES',
    directories: [
        {
            name: 'ACTION',
            directories: [
                {
                    name: 'FPS',
                    directories: [],
                    files: [
                        { name: 'doom.exe',   link: 'https://archive.org/details/The_Ultimate_Doom' },
                        { name: 'quake.exe',  link: 'https://archive.org/details/quake106.html' }
                    ]
                },
                {
                    name: 'PLATFORM',
                    directories: [],
                    files: [
                        { name: 'keen4e.exe', link: 'https://archive.org/details/CommanderKeenGoodbyeGalaxy' }
                    ]
                }
            ],
            files: [
                { name: 'sw.bat', data: 'cls\ncd\\GAMES\\ACTION\ndir/w/o\n' }
            ]
        },
        {
            name: 'STRATEGY',
            directories: [],
            files: [
                { name: 'sc2000.exe', link: 'https://archive.org/details/msdos_SimCity_2000_-_CD_Collection_1994' }
            ]
        }
    ],
    files: [
        { name: 'sw.bat', data: 'cls\ncd\\GAMES\ndir/w/o\n' }
    ]
}

Tip: Add a .BAT file at each level to make navigation easier:

{ name: 'ACTION.BAT', data: 'cls\ncd\\GAMES\\ACTION\ndir/w/o\n' }

Users can then type action from anywhere to jump straight in.


Executing Files in Nested Subdirectories

Files can only be executed from the directory they live in — there is no PATH support. To run a file, the user must first cd into its directory.

Running a URL from a Nested Directory

Given this filesystem:

{
    name: 'GAMES',
    directories: [
        {
            name: 'ACTION',
            directories: [
                {
                    name: 'FPS',
                    directories: [],
                    files: [
                        { name: 'doom.exe', link: 'https://archive.org/details/The_Ultimate_Doom' }
                    ]
                }
            ],
            files: []
        }
    ],
    files: []
}

To open doom.exe the user navigates to it first:

cd\games\action\fps
doom

Or using chained commands on one line:

cd\games\action\fps & doom

Running a BAT from a Nested Directory

Batch files work the same way — navigate to the directory, then type the filename.

Given:

{
    name: 'GAMES',
    directories: [
        {
            name: 'ACTION',
            directories: [],
            files: [
                { name: 'fps.bat', data: 'cls\ncd\\GAMES\\ACTION\\FPS\ndir/w/o\n' }
            ]
        }
    ],
    files: []
}

To run fps.bat:

cd\games\action
fps

Using a BAT to Launch a File from Anywhere

Because cd works inside batch scripts, you can write a launcher .BAT that navigates and runs a file in one step. Place it anywhere convenient (e.g. the drive root or a top-level directory):

// In C:\ root files:
{ name: 'doom.bat', data: 'cd\\games\\action\\fps\ndoom\n' }

The user can then type doom from any directory and it will navigate and launch automatically.

Absolute vs Relative Paths in BAT Files

Syntax Behaviour
cd\\games\\action Absolute — always goes to C:\GAMES\ACTION regardless of current location
cd action Relative — only works if ACTION is a child of the current directory
cd .. Relative — goes up one level

Always use absolute paths (starting with \\) in .BAT files to avoid broken navigation when the script is run from an unexpected location.


Changing the Boot Directory

AUTOEXEC.BAT runs automatically on load. It's defined in the root files array:

files: [
    { name: 'autoexec.bat', data: 'c:\ncd lgr\ncls\ndir/w/o\n' },
    ...
]

To boot into a different directory, change cd emulators to the path you want:

{ name: 'autoexec.bat', data: 'c:\ncd emulators\\dos\ncls\ndir/w/o\n' }

Setting a Custom Color Scheme

Use setcol in AUTOEXEC.BAT to set colors on boot. The argument is two hex digits: background then foreground.

{ name: 'autoexec.bat', data: 'echo off\nsetcol 17\nc:\ncd lgr\ncls\ndir/w/o\n' }
Code Background Foreground
07 Black Light Gray (default)
17 Dark Blue Light Gray
2e Dark Green Yellow
4e Dark Red Yellow
0a Black Green
0f Black White

See the Font System page for the full 16-color palette reference.


Full Example

A new platform added to the emulator library with its own subdirectories:

{
    name: 'ARCADE',
    directories: [
        {
            name: 'CAPCOM',
            directories: [],
            files: [
                { name: 'sf2.exe',     link: 'https://archive.org/details/...' },
                { name: 'ghosts.exe',  link: 'https://archive.org/details/...' }
            ]
        },
        {
            name: 'NAMCO',
            directories: [],
            files: [
                { name: 'pacman.exe',  link: 'https://archive.org/details/...' },
                { name: 'galaga.exe',  link: 'https://archive.org/details/...' }
            ]
        }
    ],
    files: [
        { name: 'sw.bat', data: 'cls\ncd\\EMULATORS\\ARCADE\ndir/w/o\n' }
    ]
}

Boot straight into it by updating AUTOEXEC.BAT:

{ name: 'autoexec.bat', data: 'c:\ncd emulators\\arcade\ncls\ndir/w/o\n' }

Clone this wiki locally