A .profile script for DOS shell

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
djangofan
Posts: 23
Joined: 04 Nov 2011 12:28

A .profile script for DOS shell

#1 Post by djangofan » 28 Nov 2012 17:51

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

djangofan
Posts: 23
Joined: 04 Nov 2011 12:28

Re: A .profile script for DOS shell

#2 Post by djangofan » 29 Nov 2012 21:12

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.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: A .profile script for DOS shell

#3 Post by foxidrive » 30 Nov 2012 03:13

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.

Post Reply