Computing.Net > Forums > Programming > CMD.EXE Beature(Bug/Feature)

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to get for your free account now!

CMD.EXE Beature(Bug/Feature)

Reply to Message Icon

Name: Holla
Date: December 10, 2008 at 22:58:47 Pacific
OS: Vista
CPU/Ram: Intel Core2 Duo/2GB
Manufacturer/Model: Dell / VOSTRO 1510
Comment:

I realized that if you have a doskey macro defined and if you input that macro string as input for any set /p varname= command, later on varname contains the alias of your input.
NOT your input!
see:

C:\holla\bat\t>doskey fit=dir

C:\holla\bat\t>doskey xla=cls

C:\holla\bat\t>set /p llll=Macro1?
Macro1?xla

C:\holla\bat\t>echo %llll%
cls

C:\holla\bat\t>set /p llll=Macro2?
Macro2?fit

C:\holla\bat\t>echo %llll%
dir

C:\holla\bat\t>set /p llll=Macro3?
Macro3?DoesNotExist

C:\holla\bat\t>echo %llll%
DoesNotExist

C:\holla\bat\t>

--
Holla.
[Edited to remove some confusion]


Report Offensive Message For Removal

Sponsored Link
Ads by Google

Response Number 1
Name: Judago
Date: December 11, 2008 at 14:04:32 Pacific
Reply:

I think this may be a result of the way set /p is handled. Set /p appears to mimic a command line, which is of course evident in your example. The reason that leads me to this idea is the way input into a set /p command becomes part of the recent command list whilst at the command line. Perhaps doskey "thinks" it's being asked to supply the information attatched to the alias because set /p appears to be the command processor.

Of course this is just speculation......


Report Offensive Follow Up For Removal
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: CMD.EXE Beature(Bug/Feature)

How to open cmd.exe in VB6 www.computing.net/answers/programming/how-to-open-cmdexe-in-vb6/7943.html

java cmd.exe www.computing.net/answers/programming/java-cmdexe/14740.html

need MD5 hash for XP CMD.EXE & PING www.computing.net/answers/programming/need-md5-hash-for-xp-cmdexe-ping/16712.html