ERROR_BAD_PATHNAME 161 (0xA1) [Solved]
Check the path and grant administrative privileges
4 min. read
Updated on
Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more
The ERROR_BAD_PATHNAME Windows system error, with code 161 (0xA1), commonly appears when running a code or application using an incorrect path or without administrator permissions. The error message reads, 161 (0xA1) The specified path is invalid.
Before you proceed to the solutions, restart the PC, check the code (if running one), and install all pending Windows updates. For most of you, this should fix the system error!
How can I fix ERROR_BAD_PATHNAME?
1. Check the path in the code
When faced with ERROR_BAD_PATHNAME Error Code 161, your primary approach should be to check the listed path. Misplaced slashes are a common issue here.
For instance, users go with \\SOFTWARE\Company while it should ideally be SOFTWARE\Company in the path. Upon making this change, the code should no longer throw The specified path is invalid message.
2. Restart File Explorer
- Press Ctrl + Shift + Esc to open the Task Manager.
- Select the Windows Explorer entry, and click on Restart task near the top right.
- Reboot the PC and check for improvements.
3. Run the affected program as an administrator
- Right-click on the affected program’s launcher, and select Properties.
- Navigate to the Compatibility tab, and tick the checkbox for Run this program as an administrator.
- Finally, click on Apply and OK to save the changes, and verify whether ERROR_BAD_PATHNAME is fixed.
4. Grant administrative privileges to the affected user
- Sign out of the current account and then log into an administrator account on the PC.
- Press Windows + I to open Settings, go to Accounts from the navigation pane, and click on Other users on the right.
- Expand the account affected by the error, and click the Change account type button.
- Select Administrator from the Account type dropdown menu, and click OK to save the changes.
If the current user profile does not have the required privileges to perform an action, you will face the ERROR_BAD_PATHNAME 161 (0xA1) issue. A quick solution here is to make the user profile an administrator, granting it all the critical permissions.
5. Modify the Registry
- Press Windows + S to open Search, type Registry Editor, and click on the relevant result.
- Click Yes in the UAC prompt.
- Paste the following path in the address bar at the top and hit Enter:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager
- Now, right-click on the empty space towards the right, hover the cursor over New, select DWORD (32-bit) Value, and name it ObjectSecurityMode.
- Double-click on the newly created DWORD.
- Enter 0 under the Value data field, and click OK to save the changes.
- Finally, reboot the PC and check for improvements.
6. Create a new user profile
- Press Windows + R to open Run, type netplwiz in the text field, and hit Enter.
- Click on Add.
- Click on Sign in without a Microsoft account.
- Now, click the Local account button.
- Enter the new profile’s username and password (not mandatory), click Next to create the account, and then click on Finish.
- Next, select the user profile from the list, and click on Properties.
- Go to the Group Membership tab, select Administrator, and click on Apply and OK to save the changes.
- Finally, sign out of the current account, log in to the new user profile, and verify whether ERROR_BAD_PATHNAME is fixed for the affected app or code.
7. Perform a system restore
- Press Windows + S to open Search, type Create a restore point, and click on the relevant result.
- Click the System Restore button.
- Select the Choose a different restore point option, and click on Next.
- Pick a restore point created before the issue first appeared or the oldest one from the list, and click Next.
- Verify the restore details, click on Finish, and confirm the change.
- Wait for the restore to complete. It typically takes 15-30 minutes.
If you can’t identify the factors triggering the ERROR_BAD_PATHNAME The specified path is invalid error, a system restore will let you quickly revert any conflicting changes and get things up and running in no time.
Before you leave, discover expert-recommended tips to make Windows 11 faster than ever and enjoy an unparalleled experience!
Which fix worked for you? Share with our readers in the comments section.
User forum
0 messages