0

In my school to use CMD you have to run it via command.com

When I do this and use the command "help" it will open the batch file help instead of displaying the help command.

Just out of interest, is there anyway to get past this other than moving or renaming the file?

3
  • 1
    Please look at stackoverflow.com/questions/605101/… Commented Nov 2, 2011 at 22:31
  • Sweet, thanks! Just what I was looking for Commented Nov 2, 2011 at 22:36
  • If you found my comment is useful, don't forget to give an upvote. Commented Nov 3, 2011 at 18:17

2 Answers 2

1

You may know the full path name (with extension) of the executable file with the Batch file below (I call it PATHOF.BAT):

@ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION REM CREATE A LIST OF FILE NAMES ADDING THE EXECUTABLE EXTENSIONS SET NAMEEXT=!PATHEXT:.=%1.! REM SEARCHES FILE NAMES IN CURRENT DIRECTORY, IF FOUND: ERRORLEVEL=1 FOR %%N IN (%NAMEEXT%) DO IF EXIST %%N ECHO %%N & EXIT /B 1 REM SEARCHES FILE NAMES IN DIRECTORIES OF PATH VARIABLE, IF FOUND: ERRORLEVEL=2 FOR %%N IN (%NAMEEXT%) DO IF NOT "%%~$PATH:N" == "" ECHO %%~$PATH:N & EXIT /B 2 REM IF FILE NOT FOUND, ERRORLEVEL=0 ECHO '%1' is not an external command or batch file located in PATH & EXIT /B 0 

For example: pathof help

Sign up to request clarification or add additional context in comments.

Comments

1

Maybe you could specify the absolute path to the help command you want.

3 Comments

Thats the thing, whats the help command called? Is it help.com? If you just have "Help" it wont work, it will find Help.cmd. If you use "Help.com" it will say its not a recognized as an inter.... ect
@GarethJones: You may know the name of the command. See my answer
Its help.exe, and is probably located at c:\windows\system32\help.exe. The other thing you could do, is call help.exe and that should skip your script and just call the right program. That script above is pretty cool though, never thought to try something with windows bat/cmd file.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.