|
-
February 25th, 2003, 06:46 PM
#1
Testing for DOSKEY macro in a batch file
Hi folks;
Is there some way I can test for the existance of a DOSKEY macro within a batch file? Foe example:
if exist DOSKEY MACRO goto Menu
I know that line is no good, but wonder if there's a way.
Related to that question, is there any harm in simply redefineing a macro that already exists? For example:
:: Some batch file
@echo off
DOSKEY MacroName=function
Suppose that batch file gets run several times, the MacroName macro will get defined every time. Is this any kind of problem?
Thanks all, Dex
-
February 26th, 2003, 05:50 AM
#2
You could do something like this:
Code:
@echo off
:CheckIt
doskey/macros|find/i "dira=dir/a/o/p"
if errorlevel 0 if not errorlevel 1 goto End
:SetIt
doskey dira=dir/a/o/p
goto CheckIt
:End
(In other words, it'll only setup a doskey macro named DIRA if it isn't already defined).
But, this isn't really necessary. Whenever you create a doskey macro that has the same name as one already defined, it simply overwrites the old one.
More info here: http://www.vfrazee.com/ms-dos/6.22/help/doskey.htm
-
February 26th, 2003, 05:28 PM
#3
Thanks Vernon, thats what I was looking for.
Dex
-
February 27th, 2003, 05:55 AM
#4
You're Welcome.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|