Welcome back to the Adventure!
This is Adam, and today we are working with macros.
Similar to batch files, Macros execute a series of commands.
However, the Macro is created and managed using DOSKEY.
You can also use DOSKEY to create batch file.
Let's take a look at how that works first.
DOSKEY stores recently used commands in memory, so we can retrieve and edit them easily.
The command remain in memory until the computer is restarted or DOSKEY is unloaded from memory,
or is so many commands have been entered the oldest ones need to be discarded so the new
ones can be stored.
Because the commands are stored in memory we can redirect them to a batch file.
First we need to type a few commands.
Now that we have a few command s in memory we can review them by using the /H switch
for DOSKEY.
There we go!
As we discussed before the output of the command can be redirected to a file using the greater
than symbol followed by the file name.
Now we have a batch file but it needs a little bit of work.
Let's open it in the Edit program.
Now we need to remove the command for looking at the DOSKEY history down here.
Then we should replace test with %1. %1 is a replaceable parameter so we can define what
%1 is when we go to run the batch file.
Now we have a usable batch file.
So that batch file created the directory "Adventure" and it changed to the directory, showed the
directory listing, and then went back out to the root f the drive exactly as it is supposed
to do.
Now for using DOSKEY to create a macro.In some ways this is easier than creating a batch
file.
We need a name for the Macro followed by an equals sign then the commands we want to Macro
to carry out.We can still use replaceable parameters but instead of %1 use $1 for example
if we want to see a directory listing with all sub-directories at the top and pause after
each page of results we can do this.
So we will start with alt F7 to clear the DOSKEY history before we type these commands.
DSUBSis our name.and it is going to be DIR $1 /OG to sort all the sub-directories at
the top followed by /p so there is a pause after each page.
Now say we want to quickly be able to switch between resolutions using the MODE command
we could use these two macros.
And we can even combine the DIR and MODE commands using the same macro to give us the most results
on a single page as possible.
to separate the commands in the Macro we use $T so it will look like this.
Okay now let's do a quick test for each of those macros that we created starting with
DSUBS. and its going to be on c:\DOS.
okay so that is going to organize all of the sub-directories at the top and then everything
else bellow it.
and then
we have little which is going to give us that
smaller resolution here and we can go back and see what that looks like with DSUBS.
Obviously the text is a little bit smaller on the screen.
Lastly we have that DIR43 so that is going to show us everything in the wide format with
the smaller text.
Alright, that concludes our look at Macros Thanks for stopping by.See you next video