Error exec: cmd

FQBN: esp32:esp32:esp32da
Using board 'esp32da' from platform in folder: C:\Users\Acer\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11
Using core 'esp32' from platform in folder: C:\Users\Acer\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11


cmd /c if exist "C:\\Users\\Acer\\Documents\\Arduino\\Gas_Test_2\\partitions.csv" COPY /y "C:\\Users\\Acer\\Documents\\Arduino\\Gas_Test_2\\partitions.csv" "C:\\Users\\Acer\\AppData\\Local\\Temp\\arduino\\sketches\\A3CD855AEA5FB35A9886469A292EDF0D\\partitions.csv"
exec: "cmd": cannot run executable found relative to current directory

Compilation error: exec: "cmd": cannot run executable found relative to current directory

hello anyone can help me to solve this problem ?

Hi @noor_am. This error message indicates that the file cmd.exe is present in the same folder from which you ran Arduino IDE. For security reasons, Arduino IDE will not run the executable under these conditions.

The occurrence of these conditions when using cmd.exe (the Windows command interpreter) is quite unexpected. I wasn't able to reproduce it on my computer even by starting Arduino IDE from the folder where that file is located (C:\Windows\System32). I could only reproduce it by copying the cmd.exe file to another folder and then starting Arduino IDE from that folder.

Do you have any idea why this might be happening? Did you copy the cmd.exe file to the Arduino IDE installation folder?

yes, i copy cmd.exe to arduino IDE folder.
what should i do now ?

Please provide a detailed description of the reason why you copied cmd.exe to the Arduino IDE folder. I need to understand this in order to be able to advise you on the correct solution for the problem.

i see in forum several people have same problem with me and I saw one post that he copied cmd.exe from C:\Windows\System32 folder to my C:\Program Files (x86)\Arduino and he said it worked

Please provide a detailed description of this mysterious "problem" you were having that motivated you to copy cmd.exe to C:\Program Files (x86)\Arduino.

I am here to help you, but I can only do that if you will make the effort to provide the information required to do so. Maybe you think you are saving time by writing these short vague responses but I can assure you that is not the case. The choice of how this goes is up to you.

first problem is "exec: "cmd": executable file not found in %PATH%" until I saw one post that he copied cmd.exe from C:\Windows\System32 folder to my C:\Program Files (x86)\Arduino he said it worked, and i try it to my arduino IDE in the hope that this will work too and the problem has become like now

OK, great. This error indicates that you have some unusual configuration of Windows that causes the path to cmd.exe to not be in your system Path environment variable. You can fix the problem by adding that path to the environment variable.

I'll provide instructions you can follow to do that:

  1. Right click the "Start" icon on the left side of the Windows taskbar
  2. Select "System" from the menu.
    The "Settings" window will open.
  3. Click the "Advanced system settings" link you find under the "Related Links" (or "Related Settings" if you are using Windows 10) section of the "Settings" window.
  4. If you get a "User Account Control" dialog, click the Yes button.
  5. In the "System Properties" window, select the "Advanced" tab.
  6. Click the Environment Variables button.
    An "Environment Variables" dialog will open.
  7. Select the "Path" variable from under the "System variables" section of the dialog "Environment Variables" dialog.
    An "Edit environment variable" dialog will open.
  8. Click the New button in the "Edit environment variable" dialog.
  9. Type %SystemRoot%\system32
  10. Click the OK button in the "Edit environment variable" dialog.
  11. Click the OK button in the "Environment Variables" dialog.
  12. Restart Arduino IDE if it is running.

Now try compiling or uploading to your ESP32 board again. Hopefully the "exec: "cmd": executable file not found in %PATH%" error will no longer occur.


Please let me know if you have any questions or problems while following those instructions.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.