{"id":12007,"date":"2025-09-29T02:00:00","date_gmt":"2025-09-29T06:00:00","guid":{"rendered":"https:\/\/www.both.org\/?p=12007"},"modified":"2025-10-02T10:32:52","modified_gmt":"2025-10-02T14:32:52","slug":"3-ways-i-use-aliases-in-freedos","status":"publish","type":"post","link":"https:\/\/www.both.org\/?p=12007","title":{"rendered":"3 ways I use aliases in FreeDOS"},"content":{"rendered":"<div class=\"pld-like-dislike-wrap pld-template-1\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"\" data-post-id=\"12007\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                        <i class=\"fas fa-thumbs-up\"><\/i>\r\n                <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">    <\/span>\r\n<\/div><\/div>\n<p>Like any DOS, FreeDOS has a limited amount of memory, and everything has a limit that is pretty short compared to what you might think of on Linux. Even though FreeDOS is a more modern version of DOS than MS-DOS, with built-in features like <em>command history<\/em> and <em>aliases<\/em>, it&#8217;s still limited by the same memory model as the original MS-DOS.<\/p>\n\n\n\n<p>This presents a challenge in using the DOS command line. For example, a single command line, such as a command to set an environment variable like <code>PATH<\/code>, cannot be too long or you get an error. Even the workarounds have limitations; for example, you can try this experiment to &#8220;stitch&#8221; together several 80-character variables into one command, such as to set an environment variable, to see that you can&#8217;t get very far by expanding variables to set a longer command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C:\\&gt;set Z=zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzz\nC:\\&gt;set LONG=%Z%;%Z%;%Z%;%Z%\nCommandline longer than 125 characters.\nC:\\&gt;set LONG=%Z%;%Z%;%Z%\nC:\\&gt;echo %LONG%\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\n;zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nz;zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzz<\/code><\/pre>\n\n\n\n<p>From a practical perspective, you cannot set a very long <code>PATH<\/code>. This is a problem if you want to be able to run <em>any program<\/em> that you&#8217;ve installed, at any time. The <code>PATH<\/code> stores a list of all the directories that might contain programs you can run, such as <code>C:\\freedos\\bin<\/code> but may contain other program locations like the Open Watcom C compiler at <code>C:\\devel\\watcomc\\binw<\/code> or the Open Watcom FORTRAN 77 compiler at <code>C:\\devel\\watcomf\\binw<\/code>. Or you might have games installed at <code>C:\\games<\/code>, with subdirectories for each game like <code>C:\\games\\senet<\/code> or <code>C:\\games\\freedoom<\/code>. You might have other programs you like to use in other locations, like <code>C:\\apps\\fed<\/code> for the FED editor, or <code>D:\\apps\\aseasy<\/code> or <code>D:\\apps\\word55<\/code> for third-party DOS applications like As-Easy-As or Word for DOS. But if you can&#8217;t make a command line that&#8217;s very long, all of those directory locations can fill up a command line pretty quickly.<\/p>\n\n\n\n<p>The FreeDOS distribution installs tiny <code>COM<\/code> program stubs in the <code>C:\\freedos\\links<\/code> directory to run some programs like the IA-16 GCC compiler without adding the full directory location to your <code>PATH<\/code>, but I prefer to use <em>command aliases<\/em> instead.<\/p>\n\n\n\n<p>Using an alias takes up some memory too, but the tradeoff is that my <code>PATH<\/code> variable doesn&#8217;t get too long. With aliases, you can avoid having to add elements to the <code>PATH<\/code>, and instead can just run them like regular commands <em>as though they were in the PATH<\/em>. Aliases make other things possible too. Here are 3 ways that I use aliases on FreeDOS:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"to-run-a-command-outside-the-path\">1. To run a command outside the PATH<\/h2>\n\n\n\n<p>Before I can compile programs, I need to set up the C compiler so it can run the pre-processor, compiler, and linker programs. For the Open Watcom C compiler, that means adding <code>C:\\devel\\watcomc\\binw<\/code> to my <code>PATH<\/code> variable, and defining other variables for the compiler. To set everything at once, I use the <code>C:\\devel\\watcomc\\owsetenv.bat<\/code> batch file.<\/p>\n\n\n\n<p>When I write programs on FreeDOS, I usually use the <strong>fed<\/strong> editor to write the source code. <strong>fed<\/strong> is a <em>folding<\/em> editor that supports all kinds of customizations, which I find makes it easy to use for writing source code. The <strong>fed<\/strong> editor is installed in a completely different directory, under <code>C:\\apps\\fed<\/code>. If I want to run <strong>fed<\/strong>, I have to add it to the <code>PATH<\/code>.<\/p>\n\n\n\n<p>Except there&#8217;s no point in adding that to an already-long <code>PATH<\/code> just to run one program. Instead, I create an alias to <strong>fed<\/strong>, so I can run it just like it was already in the <code>PATH<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>alias fed=C:\\apps\\fed\\fed.exe<\/code><\/pre>\n\n\n\n<p>If I&#8217;m booting into FreeDOS to do some &#8220;work&#8221; (like doing something in a spreadsheet) I might add an alias to run the spreadsheet from wherever I happen to be. My favorite DOS spreadsheet is <a href=\"https:\/\/technicallywewrite.com\/2025\/09\/16\/aseasybook\">As-Easy-As for DOS<\/a> so I might add this alias:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>alias aseasy=D:\\apps\\aseasy\\aseasy.exe<\/code><\/pre>\n\n\n\n<p>Or if I want to write something in a word processor, such as an article about DOS, I might make an alias to run the application from wherever I am. Microsoft released Word for DOS 5.5 as a free (gratis) download a few years ago, and that&#8217;s a very nice word processor for DOS. To run Word without adding it to the <code>PATH<\/code>, I create this alias:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>alias word=D:\\apps\\word55\\word.exe<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"to-run-commands-with-a-default-parameter\">2. To run commands with a default parameter<\/h2>\n\n\n\n<p>It used to be that when you were done working on DOS, you&#8217;d just turn off the computer. But as DOS added disk caches, network access, and other features, <em>shutting down<\/em> was more than just <em>powering off<\/em>. These days, the best way to shut down your DOS machine is to first flush the caches and do a few other things; the <strong>fdapm<\/strong> command with the <code>poweroff<\/code> option will do all of this for you, including a <em>power management<\/em> (APM) instruction to power off the machine for you. Or if you used the <code>warmboot<\/code> option, <strong>fdapm<\/strong> will reboot the machine instead.<\/p>\n\n\n\n<p>To make it easier for users to reboot or power off the machine, the FreeDOS distribution creates several aliases to other commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>alias reboot=fdapm warmboot\nalias halt=fdapm poweroff\nalias shutdown=fdapm poweroff<\/code><\/pre>\n\n\n\n<p>This means that if you want to turn off the DOS machine, you just type <strong>shutdown<\/strong> and the shell instead executes <strong>fdapm<\/strong> to power down the system. If you instead type <strong>reboot<\/strong>, the shell instead runs <strong>fdapm<\/strong> to reboot.<\/p>\n\n\n\n<p>I use the same method to run a program that is outside the <code>PATH<\/code> that otherwise would require a DOS extender program to run. For example, the Open Watcom <strong>vi<\/strong> editor is quite nice, and sometimes I might like to use that to edit a few simple files. But if you try to run the <strong>vi<\/strong> editor on its own, you&#8217;ll get an error that the program cannot be used without the <code>DOS4GW<\/code> extender. This is included with Open Watcom, but unless Open Watcom is already in your <code>PATH<\/code>, it fails:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>D:\\SRC&gt; C:\\devel\\watcomc\\binw\\vi.exe\nStub exec failed:\n\\dos4gw.exe\nNo such file or directory<\/code><\/pre>\n\n\n\n<p>Instead, I create an alias so that whenever I type <strong>vi<\/strong>, I actually run the editor using <code>DOS4GW<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>alias vi=C:\\devel\\watcomc\\binw\\dos4gw.exe C:\\devel\\watcomc\\binw\\vi.exe<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"to-run-a-command-with-a-different-name\">3. To run a command with a different name<\/h2>\n\n\n\n<p>Sometimes, my fingers want to type a Linux command when I&#8217;m on FreeDOS. For example, to copy a file on DOS, you use the <strong>copy<\/strong> command, but you&#8217;d use the <strong>cp<\/strong> command on Linux. To see the list of files in the current directory, you use the <strong>dir<\/strong> command, not the <strong>ls<\/strong> command. To display the contents of a text file, you use the <strong>type<\/strong> command on DOS, not the <strong>cat<\/strong> command from Linux.<\/p>\n\n\n\n<p>To avoid getting the &#8220;Bad command or filename&#8221; error when all I wanted to do was see a list of files, or display a file, or copy a file, I sometimes add aliases to the equivalent Linux commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>alias ls=DIR\nalias cp=COPY\nalias rm=DEL\nalias cat=TYPE<\/code><\/pre>\n\n\n\n<p>I might even update the aliases to add a few command line options to make the output look more like the Linux equivalent, such as displaying file lists in &#8220;wide&#8221; format, all lowercase, and without the summary:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C:\\DEVEL\\WATCOMC&gt; alias ls=DIR \/W \/L \/B\n\nC:\\DEVEL\\WATCOMC&gt; ls\n&#91;.]            &#91;..]           &#91;binl]         &#91;binnt]        &#91;binp]\n&#91;binw]         &#91;eddat]        &#91;h]            &#91;lh]           &#91;lib286]\n&#91;lib386]       &#91;nlm]          &#91;rdos]         &#91;samples]      &#91;src]\n&#91;wipfc]        instlic.txt    license.txt    owsetenv.bat   readme.txt\nreadme.w32<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"aliases-are-a-great-addition-to-your-dos-toolset\">Aliases are a great addition to your DOS toolset<\/h2>\n\n\n\n<p>Command aliases are a FreeDOS extension in <code>command.com<\/code> (called &#8220;FreeCOM&#8221;), and they work pretty much like command aliases in Bash on Linux. Aliases are a great addition to your DOS toolset, and can make it easier to work from the command line. Explore creating your own aliases in FreeDOS using the <strong>alias<\/strong> command!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are 3 ways that I use aliases on FreeDOS:<\/p>\n","protected":false},"author":33,"featured_media":2815,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[100,340],"tags":[104,267],"class_list":["post-12007","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-command-line","category-freedos","tag-command-line","tag-freedos"],"modified_by":"Jim Hall","_links":{"self":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/12007","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/users\/33"}],"replies":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12007"}],"version-history":[{"count":3,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/12007\/revisions"}],"predecessor-version":[{"id":12073,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/12007\/revisions\/12073"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/media\/2815"}],"wp:attachment":[{"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12007"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12007"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12007"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}