Failed To Open Dlllist.txt For Reading Error Code 2 Guide
To ensure scripts never fail with error code 2, adopt these best practices.
While dlllist.exe from Sysinternals is the most common source, the error can also appear in:
If you have tried the above and are still facing issues, the Dependency Walker installation itself might be corrupt.
On 64-bit Windows, running 32-bit tools from SysWOW64 may cause file system redirector issues. Use: failed to open dlllist.txt for reading error code 2
%windir%\Sysnative\cmd.exe
Then run your dlllist command from there.
Check current working directory
Use absolute path
Verify filename and extension
Permissions
Antivirus or locking
Corrupt install or missing resources
Running from archive or package
App expects generated file
try
& ".\dlllist.exe" "@dlllist.txt" -ErrorAction Stop
catch
if ($_.Exception.Message -match "error code 2")
Write-Host "Missing dlllist.txt – creating now"
New-Item -Path "dlllist.txt" -ItemType File
& ".\dlllist.exe" "@dlllist.txt"
Define a wrapper that checks for the response file and creates it if missing.
| Possible cause | Check / Fix |
|----------------|--------------|
| File permissions | Right-click dlllist.txt → Properties → Security → ensure your user has Read & Write. |
| Path too long | Move the program folder to C:\temp\ or D:\games\ — avoid deep nested paths. |
| Program bug | Some old tools hardcode C:\dlllist.txt — create the file in C:\ as well. |
| Corrupted executable | Redownload the tool from an official source. |