A helpful function in nearly each command-line setting is the setting variable. Some of those variables mean you can management the conduct or options of the command line, and different variables merely mean you can retailer knowledge that you simply may must reference later. Environment variables are additionally utilized in FreeDOS.
Variables on Linux
On Linux, it’s possible you’ll already be conversant in a number of of those necessary setting variables. In the Bash shell on Linux, the
PATH variable identifies the place the shell can discover packages and instructions. For instance, on my Linux system, I’ve this
bash$ echo $PATH
That means after I sort a command identify like
cat, Bash will verify every of the directories listed in my
PATH variable, so as:
And in my case, the
cat command is positioned within the
/usr/bin listing, so the total path to that command is
To set an setting variable on Linux, you sort the identify of the variable, then an equals signal (
=) after which the worth to retailer within the variable. To reference that worth later utilizing Bash, you sort a greenback signal (
$) in entrance of the variable identify.
bash$ echo $var
Variables on FreeDOS
On FreeDOS, setting variables serve an analogous operate. Some variables management the conduct of the DOS system, and others are helpful to retailer some short-term worth.
To set an setting variable on FreeDOS, you have to use the
SET key phrase. FreeDOS is case insensitive, so you’ll be able to sort that utilizing both uppercase or lowercase letters. Then set the variable as you may on Linux, utilizing the variable identify, an equals signal (
=), and the worth you need to retailer.
However, referencing or increasing an setting variable’s worth in FreeDOS is kind of totally different from the way you do it on Linux. You cannot use the greenback signal (
$) to reference a variable in FreeDOS. Instead, you have to encompass the variable’s identify with p.c indicators (
It’s necessary to make use of the p.c indicators each earlier than and after the identify as a result of that is how FreeDOS is aware of the place the variable identify begins and ends. This could be very helpful, because it means that you can reference a variable’s worth whereas instantly appending (or prepending) different textual content to the worth. Let me exhibit this by setting a brand new variable known as
reply with the worth
sure, then referencing that worth with the textual content “11” earlier than and “22” after it:
Because FreeDOS is case insensitive you too can use uppercase or lowercase letters for the variable identify, in addition to the
SET key phrase. However, the variable’s worth will use the letter case as you typed it on the command line.
Finally, you’ll be able to see a listing of all of the setting variables at the moment outlined in FreeDOS. Without any arguments, the
SET key phrase will show all variables, so you’ll be able to see all the things at a look:
Environment variables are a helpful staple in command-line environments, and the identical applies to FreeDOS. You can set your individual variables to serve your individual wants, however watch out about altering a few of the variables that FreeDOS makes use of. These can change the conduct of your operating FreeDOS system:
- DOSDIR: The location of the FreeDOS set up listing, often
- COMSPEC: The present occasion of the FreeDOS shell, often
- LANG: The consumer’s most well-liked language
- NLSPATH: The location of the system’s language recordsdata, often
- TZ: The system’s time zone
- PATH: A listing of directories the place FreeDOS can discover packages to run, akin to
- HELPPATH: The location of the system’s documentation recordsdata, often
- TEMP: A brief listing the place FreeDOS shops output from every command because it “pipes” knowledge between packages on the command line
- DIRCMD: A variable that controls how the
DIRcommand shows recordsdata and directories, sometimes set to
/OGNEto order (O) the contents by grouping (G) directories first, then sorting entries by identify (N) then extension (E)
If you unintentionally change any of the FreeDOS “internal” variables, you might forestall some components of FreeDOS from working correctly. In that case, merely reboot your laptop, and FreeDOS will reset the variables from the system defaults.