Order in which command prompt executes files with the same name (a.bat vs a.cmd vs a.exe)

后端 未结 1 934
说谎
说谎 2020-11-30 06:16

What is the order in which the Windows command prompt executes files with the same name, but different extensions?

For example, I have a bunch of executable files: <

相关标签:
1条回答
  • 2020-11-30 06:39

    Okay, I did some quick experimentation based on some other searches I had going.

    The gist is that the order of the commands is dependent on the order the extensions are stored in the PATHEXT environment variable. So initially I had:

    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.RB;.RBW
    

    and for the example above the order in which it would run it was:

    something.exe
    something.bat
    something.cmd
    

    Changing the order which they were defined in the PATHEXT environment variable did indeed change the order in which they were executed.

    0 讨论(0)
提交回复
热议问题