-
Notifications
You must be signed in to change notification settings - Fork 0
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.
Open prompt/index.html and search for:
var fs = [{Everything between that line and the closing }]; is the filesystem.
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 GitHub link to C:\LGR:
{
name: 'LGR',
directories: [],
files: [
{ name: 'YOUTUBE.COM', link: 'https://www.youtube.com/@LGR' },
{ name: 'GITHUB.COM', link: 'https://github.com/yourname' }, // added
...
]
}The user can then type github or github.com at the prompt to open it.
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' }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 C:\MUSIC alongside the existing C:\LGR and C:\GAMES:
var fs = [{
name: 'c',
directories: [
{ name: 'LGR', ... },
{ name: 'GAMES', ... },
{ // added
name: 'MUSIC',
directories: [],
files: [
{ name: 'SPOTIFY.COM', link: 'https://open.spotify.com/...' },
{ name: 'BANDCAMP.COM', link: 'https://yourname.bandcamp.com' }
]
}
],
...
}];The user can then type cd\music and dir to browse it.
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.
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.
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
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
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.
| 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.
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 lgr to the directory name you want:
{ name: 'autoexec.bat', data: 'c:\ncd music\ncls\ndir/w/o\n' }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.
A complete custom directory added to the filesystem:
{
name: 'PORTFOLIO',
directories: [],
files: [
{ name: 'WEBSITE.COM', link: 'https://yoursite.com' },
{ name: 'GITHUB.COM', link: 'https://github.com/yourname' },
{ name: 'LINKEDIN.COM', link: 'https://linkedin.com/in/yourname' },
{ name: 'README.BAT', data: 'echo off\nsetcol 0b\necho Welcome to my portfolio!\nsetcol 07\necho on' }
]
}Boot straight into it by updating AUTOEXEC.BAT:
{ name: 'autoexec.bat', data: 'c:\ncd portfolio\ncls\ndir/w/o\n' }