Script is not recognized as an internal or external command, operable program or batch file

게시 날짜: 21 Feb 2019
마지막 수정 날짜: 11 Jan 2022

문제

Tableau Server를 프로그램 추가/제거에서 제거하고 소프트웨어를 다시 설치하고 나서 TSM 명령을 사용한 후 다음 오류가 발생할 수 있습니다. 

'tsm' is not recognized as an internal or external command, operable program or batch file.('tsm'이 내부 또는 외부 명령, 실행할 수 있는 프로그램 또는 배치 파일로 인식되지 않습니다.)

환경

  • Tableau Server 2018.2.6, 2018.3.3, 2019.1.1
  • Windows 2012

해결 방법

Tableau Server 2018.2.15 이상으로 업그레이드하거나,

다음 해결 방법을 시도합니다.

  1. 제어판 \시스템 및 보안\시스템으로 이동합니다.
  2. 설정 변경을 클릭합니다.
  3. "고급" 탭으로 이동합니다.
  4. Environment Variables(환경 변수)를 클릭합니다.
  5. 시스템 변수 아래의 PATH를 하이라이트합니다.
  6. Edit(편집)을 클릭합니다.
  7. 세미콜론(';')을 TSM 경로 앞에 추가합니다.
    • 추가하기 전의 예:
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Amazon\cfn-bootstrap\C:\Program Files\Tableau\Tableau Server\packages\bin.20182.19.0111.2115
  • 추가한 후의  
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Amazon\cfn-bootstrap\;C:\Program Files\Tableau\Tableau Server\packages\bin.20182.19.0122.2115

원인

이 동작은 Tableau Server의 최근 버전에서 수정된 알려진 문제(ID:870082)와 관련이 있습니다.

The Command Prompt in Windows is a handy utility. It allows you to perform many tasks quickly; however, the command processor may show the "not recognized as an internal or external command" error when you try to execute a command.

It is a common error and usually occurs due to incorrect command execution. This article explains the causes and a few troubleshooting steps to help you fix this error.

Why the Not Recognized as an Internal or External Command Error Occurs?

Windows OS keeps a list of paths known as Windows Environment Variables to launch and execute programs quickly. Any issues with it can cause the error.

Potential issues that cause this error include:

  • Incorrect commands.
  • Registry entries interrupting the functioning of commands and more.
  • Executable programs or scripts not installed.
  • An incorrectly specified path or filename.
  • A missing file directory in Windows Environment Variables.

How to Fix the "Not Recognized as an Internal or External Command" Error

This error is often triggered when you run a program or CMD command, and something goes wrong. We have listed fixes for both versions of the error, so follow the relevant one to your case.

1. Verify if the Program Is Installed

control panel installed programs

Command Prompt can’t run a program that does not exist. If you are trying to execute a newly installed program, ensure it is correctly installed.

To verify the installation:

  1. Press Win + R to open Run. Then, type control and click OK.
  2. Then, in the Control Panel, go to Programs > Programs and Features.
  3. Scroll through the list of installed apps and locate the app you want to run.

Alternatively, you can also view installed apps by accessing Apps and Features in Settings. To do this, press Windows key + I, click on Apps and locate the installed app.

By default, when you try to launch a program or a script from CMD, the command processor looks for the related files and paths in the System32 folder or environment variables. If the file is missing, it will return the not recognized as an internal or external command, operable program, or batch file error.

This is likely because Windows does not install most apps in the System32 folder, but C:\Program Files instead.

You can resolve this issue in three ways:

  1. First, use the full path of the executable file to launch the program.
  2. Second, add the program path to Windows environment variables.
  3. Finally, move the files to the System32 folder.

2. Use the Full File Path to Execute the Command

run programs using full file path

First, let's try the full path method. Here, we will use the full file path instead of the app name to launch programs from Command Prompt. Here's how to do it:

  1. First, open the Command Prompt as administrator.
  2. Next, type the full path of the application you want to launch. For example, if you want to open the ESBCalc Port located in the C:\ directory, then the command to open the app with the full path will look something like this:C:\ESBCalcPort.exe
  3. That said, this will only work if the file path does not have any white spaces. If your file path has a space, type the file path inside double-quotes.

3. Use the Full File Path Within Double Quotes

launch internet explorer double quotes cmd

Command Prompt reads the white spaces as the end of a command and treats anything after the space as a separate command.

Let’s say you want to launch the Internet Explorer app located in C:\Program Files\Internet Explorer\iexplore.exe via CMD. However, running this file path will return an error due to the space between Program Files and Internet Explorer.

To avoid this, you can insert the file path within a double quote. Here, the command to launch Internet Explorer will look like this:

"C:\Program Files\Internet Explorer\iexplore.exe"

4. Add the File Path to the Windows Environment Variables

You can edit the Environment Variables and add the file path of your application to its directory. This way, Command Prompt will identify the path for the entered command and execute it without the error.

Adding a full file path to the Windows Environment Variable can help you resolve the not recognized as an internal or external command error for the Flex, nmake, make, cobra, Is, terraform, gcc, code, Android Studio, Python, Fastboot, and ADB commands.

To edit Windows Environment Variable:

  1. Press Win + R to open Run.
  2. Next, type control and click OK to open the Control Panel.
  3. Go to System and Security > System. In the left pane, click on Advanced System Settings.

    advanced system settings

  4. On newer versions of Windows 10, go to Settings > System > About. Then, click on Advanced system settings underthe Related settings section.
  5. In the Advanced tab, click on the Environment Variables button.

    edit windows environment variable path

  6. In the new window, under System variables, select the Path variable.
  7. Click the Edit button.
  8. In the Edit window, click on New.

    add file path environment variable

  9. Here, you have to paste the program's file path you want to run from CMD. For example, if you want to run the Chrome browser located in C:\Program Files\Google\Chrome\Application, then the full file path will look like this:C:\Program Files\Google\Chrome\Application
  10. Click OK to add it to the Environment Variables.
  11. Then, click OK on all open windows to save the changes.

Once you have added the new environment variable, open Command Prompt, enter the program's name, and CMD will open it without any error.

5. Move Files to System32 Folder

move chrome files system32 folder

System32 is a protected system folder, and it is protected for a good reason. When you try to launch a program as an administrator, Command Prompt looks for the executable file in the System32 folder. However, since all the programs are not installed in the System32 folder, you may end up with an error.

If you still want to run the program from CMD and don’t want to type a full file path, you can move the program files to the System32 folder.

To move program files to the System32 folder:

  1. Navigate to the installation directory for your program and copy all the files in the folder. Here, we will move Google Chrome files located in C:\Program Files\Google\Chrome\Application to the System32 folder.
  2. Next, navigate to the C:\Windows\System32 folder and paste the copied files. Click Yes if a UAC prompt appears.
  3. Next, open the Command Prompt as administrator, type chrome, and hit enter. CMD will instantly open the Google Chrome browser.

Fixing the CMD Not Recognized as an Internal or External Command Error

Command Prompt commands are not case-sensitive, but it does not forgive of extra spaces. To resolve this error, check if the commands are correct and use file paths with spaces within double-quotes. For the programs not installed in the System32 folder, add an environment variable with your application’s full file path to launch apps through CMD.

How do I fix not recognized as an internal or external command operable program or batch file?

You can resolve this issue in three ways: First, use the full path of the executable file to launch the program. Second, add the program path to Windows environment variables. Finally, move the files to the System32 folder.

Is not Recognised as an internal or external command?

The “Python is not recognized as an internal or external command” error is encountered in the command prompt of Windows. The error is caused when Python's executable file is not found in an environment variable as a result of the Python command in the Windows command prompt.

Is not recognized as an internal or external command operable program or batch file in CMD?

The “is not recognized as an internal command” error usually occurs because the computer can't find the executable that you're asking it to launch. However, you can provide it with the full path to your executable file and it should then be able to run it without any issues. Launch a Command Prompt window on your PC.

Where is not recognized as an internal or external command operable program or batch file in Android Studio?

So, all one needs to do is to open Android Studio, click on File>Settings. In the next window, under Tools, click on Terminal. Then enter the complete location to adb in the Start Directory. Restart Android Studio and your adb command should execute now.