If I have an executable file, how should I execute it in a long path

帅楠 赵 20 Reputation points
2024-11-05T08:38:08.5566667+00:00

I have enabled the long path support configuration for Windows, but still cannot execute the. exe file in a long path. What should I do

Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

Accepted answer
  1. MotoX80 36,401 Reputation points
    2024-11-05T23:58:25.8966667+00:00

    One option that I have found is to use Powershell and create a symbolic link that points to the desired subfolder and essentially skips over the long verbose folder names.

    Let's say that you have a program name like this.

    c:\Data\MainApp\ReallyLongName\ReallyLongSubFolderName\MyApp\bin\MyApp.exe
    

    The symbolic link creates a short folder name by bypassing the long "ReallyLongName\ReallyLongSubFolderName" folders.

    New-Item -ItemType SymbolicLink -Path "c:\Data\MainApp\MyAppBin" -Target "c:\Data\MainApp\ReallyLongName\ReallyLongSubFolderName\MyApp\bin"
    

    You would use whatever names makes sense to you. This is just an example. You would run this program...

    c:\Data\MainApp\MyAppBin\MyApp.exe
    

    You can use Powershell to copy the folder name to the clipboard so that you can paste the text into notepad and build the New-Item command.

    (Get-ChildItem c:\Data\MainApp\MyApp.exe -Recurse).fullname | clip
    

    Obviously, the best solution is to shorten the folder names. Don't use long, verbose names. Abbreviate where possible.


1 additional answer

Sort by: Most helpful
  1. Anonymous
    2024-11-05T08:47:22.1033333+00:00

    Hello,

    Here are a few steps you can try to resolve this:

    Verify Registry Settings:

    Open the Registry Editor (regedit.exe).

    Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem.

    Ensure the LongPathsEnabled value is set to 1.

    Check Group Policy Settings:

    Open the Group Policy Editor (gpedit.msc).

    Navigate to Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem.

    Ensure the Enable Win32 long paths policy is set to Enabled.

    Restart Your Computer: After making these changes, restart your computer to ensure they take effect.

    Update Windows:

    Ensure that your Windows is up to date. Sometimes, updates can resolve compatibility issues and bugs related to long path support.

    Hope this helps.

    Best Regards,

    Hania Lian

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.