# This is regarding finding exe files in type

**URL:** <https://forum.codecrafters.io/t/this-is-regarding-finding-exe-files-in-type/15521>\
**Category:** Challenges\
**Tags:** challenge:shell\
**Created:** [November 12, 2025, 7:19pm UTC](https://forum.codecrafters.io/t/this-is-regarding-finding-exe-files-in-type/15521 "2025-11-12T19:19:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![banerjeesabyasachi375-svg](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/banerjeesabyasachi375-svg/32/19874_2.png) [@banerjeesabyasachi375-svg](https://forum.codecrafters.io/u/banerjeesabyasachi375-svg)\
**Post date:** [November 12, 2025, 7:19pm UTC](https://forum.codecrafters.io/t/this-is-regarding-finding-exe-files-in-type/15521/1 "2025-11-12T19:19:58Z")

</div>

```auto
 string path = Environment.GetEnvironmentVariable("PATH");
 var modPath = string.Empty;
 string[] allPaths = path.Split(Path.PathSeparator);
 bool pathFound = false;
 foreach (string path2 in allPaths)
 {
     modPath = Path.Combine(path2, array[1]+".exe");
     if(File.Exists(modPath))
     {
         Console.WriteLine($"{array[1]} is {modPath}");
         {
             pathFound = true;
             break;
         }
     }
 }
 if (pathFound)
     continue;
 Console.WriteLine($"{command.Substring(5)}: not found");

```

When i am removing .exe everything is passing except1  
remote: [your-program] my\_exe is /tmp/bar/my\_exe  
remote: [tester::#MG5] ^ Line does not match expected value.  
remote: [tester::#MG5] Expected: “my\_exe is /tmp/quz/my\_exe”  
remote: [tester::#MG5] Received: “my\_exe is /tmp/bar/my\_exe”

so i changed it to exe strict,but its not working for any scenarios  
why so

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [November 12, 2025, 7:27pm UTC](https://forum.codecrafters.io/t/this-is-regarding-finding-exe-files-in-type/15521/3 "2025-11-12T19:27:35Z")

</div>

Hey @banerjeesabyasachi375-svg , could you double-check if your code implements the following logic?

 ![](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/a/c/ac2fb0071610652c4a3855c99ed43955548fab48.png)

Note that there are multiple files with the same name in different locations, but not all of them are executable. Only the first executable should be picked up.

---

<div class="post-metadata">

**Author:** ![banerjeesabyasachi375-svg](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/banerjeesabyasachi375-svg/32/19874_2.png) [@banerjeesabyasachi375-svg](https://forum.codecrafters.io/u/banerjeesabyasachi375-svg)\
**Post date:** [November 12, 2025, 7:29pm UTC](https://forum.codecrafters.io/t/this-is-regarding-finding-exe-files-in-type/15521/4 "2025-11-12T19:29:09Z")

</div>

@andy1li thats why i am giving .exe extension at the end of the path  
but its failing for all,no test case passing

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [November 12, 2025, 7:35pm UTC](https://forum.codecrafters.io/t/this-is-regarding-finding-exe-files-in-type/15521/5 "2025-11-12T19:35:47Z")

</div>

Thanks for the clarification ! A couple of things to note:

1. None of the files in the tests actually have a .exe extension, and in fact they don’t have any extension at all.
2. Instead of relying on file extensions (which is specific to Windows), it’s better to actually check whether the file has **executable permissions**.

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [November 19, 2025, 9:35am UTC](https://forum.codecrafters.io/t/this-is-regarding-finding-exe-files-in-type/15521/6 "2025-11-19T09:35:58Z")

</div>

Closing this thread due to inactivity. If you still need assistance, feel free to reopen or start a new discussion!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [November 24, 2025, 9:36am UTC](https://forum.codecrafters.io/t/this-is-regarding-finding-exe-files-in-type/15521/7 "2025-11-24T09:36:56Z")

</div>

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