Page 1 of 1

A .profile script for DOS shell

Posted: 28 Nov 2012 17:51
by djangofan
I created a .profile script for DOS shell. I wanted to share it:

Code: Select all

@ECHO OFF 
ECHO Loading additional commands from:
ECHO    %0
ECHO Type 'DOSKEY /MACROS:ALL' to see the configured commands.
:: to install, place this .bat script in the location you want
:: it to reside and then run this batch script with the argument "register"
IF "%1"=="register" (
  REG.exe ADD "HKCU\Software\Microsoft\Command Processor\Autorun" /ve /t REG_SZ /d "%0" /f
  ECHO The DOS profile is registered.  Load a new command prompt and test a command.
)
@DOSKEY LS=DIR /w
@DOSKEY CP=COPY $*
@DOSKEY MV=MOVE $*
@DOSKEY H=DOSKEY /HISTORY
@DOSKEY WHERE=@for %%e in (%PATHEXT%) do @for %%i in ($*%%e) do @if NOT "%%~$PATH:i"=="" echo %%~$PATH:i

Re: A .profile script for DOS shell

Posted: 29 Nov 2012 21:12
by djangofan
I ran into an issue with this script. Here is my revised script: https://gist.github.com/4164472

The problem is that it works on some Windows 7 machines but not all of them. The registry entries look fine, but on one of my Windows 7 machines , when I open a command prompt, it doesn't seem to read the AutoRun key in the registry. I don't know why.... and not sure how to troubleshoot it.

Re: A .profile script for DOS shell

Posted: 30 Nov 2012 03:13
by foxidrive
These files also run when a cmd prompt is opened, unless a PIF file exists for it.

c:\Windows\System32\autoexec.nt
c:\Windows\System32\config.nt


I don't use doskey myself so can't offer much support.