Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8830403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:04:44+00:00 2026-06-14T08:04:44+00:00

I have a command’s name and I need to check if this command is

  • 0

I have a command’s name and I need to check if this command is internal. How can I do it in a batch script?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:04:46+00:00Added an answer on June 14, 2026 at 8:04 am

    So after a lot of tweaking, and thanks to the help of @Andriy M, it finally works.

    @ECHO off
    
    CALL :isInternalCommand dir dirInternal
    ECHO is dir internal: %dirInternal%
    
    CALL :isInternalCommand find findInternal
    ECHO is find internal: %findInternal%
    
    exit /b 0
    
    :isInternalCommand
    SETLOCAL
    
    MKDIR %TEMP%\EMPTY_DIR_FOR_TEST > NUL 2>& 1
    CD /D %TEMP%\EMPTY_DIR_FOR_TEST
    SET PATH=
    %~1 /? > NUL 2>&1
    IF ERRORLEVEL 9009 (ENDLOCAL
    SET "%~2=no"
    ) ELSE (ENDLOCAL
    SET "%~2=yes"
    )
    
    GOTO :EOF
    

    OLD SOLUTION

    You can use where. If it fails, the command is probably internal. If it succeeds, you get the executable path that proves it’s not internal.

    C:\Users\user>where path
    INFO: Could not find files for the given pattern(s).
    
    C:\Users\user>where find
    C:\Windows\System32\find.exe
    

    EDIT: As the comments suggest, this might not be the best solution if you’re looking for portability and not just research. So here’s another possible solution.

    Set %PATH% to nothing so HELP can’t find anything and then run HELP on the command you’re trying to check.

    C:\Users\user>set PATH=
    
    C:\Users\user>path
    PATH=(null)
    
    C:\Users\user>%WINDIR%\System32\help del
    Deletes one or more files.
    
    DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
    [...]
    
    C:\Users\user>%WINDIR%\System32\help find
    'find' is not recognized as an internal or external command,
    operable program or batch file.
    

    This might still fail if the command doesn’t have help.

    EDIT 2: Never mind, this won’t work either. Both cases return %ERRORLEVEL%=1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have next command in my batch script dir project\*.java /s /B > temp_file
I have this command to go to every directory and once there run some
I have this command in a Rails controller open(source) { |s| content = s.read
I have command like this. wmctrl -lp | awk '/gedit/ { print $1 }'
i have command ccv this will output as below Your Project : gdgdd750V64OG ,
I have a command like this: sftp user@host <<EOF put file.txt exit EOF Now
I have this command: INSERT INTO table2 (username,profile) SELECT DISTINCT username,profile FROM table1 WHERE
I have a command output like this hdisk10 128000 200B75Y4191001707210790003IBMfcp hdisk11 128000 200B75Y4191001807210790003IBMfcp hdisk13
Let's assume that we have command X which can be executed in shell and
I have this command (visibleSelect is jquery variable that holds multiple select list): var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.