ERROR_BAD_PATHNAME 161 (0xA1) [Solved]

Check the path and grant administrative privileges

Reading time icon 4 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more

ERROR_BAD_PATHNAME
XINSTALL BY CLICKING THE DOWNLOAD FILE
A message from our partner

For fixing Windows errors, we recommend Fortect:

Fortect will identify and deploy the correct fix for your Windows errors. Follow the 3 easy steps to get rid of Windows errors:

  • Download Fortect and install it on your PC
  • Launch the tool and Start scanning your PC for Windows errors
  • Right-click on Start Repair to deploy the right fix for each error encountered during the scan
Download Now Fortect has been downloaded by 0 readers this month, rated 4.6 on TrustPilot

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

  1. Press Ctrl + Shift + Esc to open the Task Manager.
  2. Select the Windows Explorer entry, and click on Restart task near the top right.restart file explorer to fix ERROR_BAD_PATHNAME
  3. Reboot the PC and check for improvements.

3. Run the affected program as an administrator

  1. Right-click on the affected program’s launcher, and select Properties.
  2. Navigate to the Compatibility tab, and tick the checkbox for Run this program as an administrator.run as administrator
  3. 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

  1. Sign out of the current account and then log into an administrator account on the PC.
  2. Press Windows + I to open Settings, go to Accounts from the navigation pane, and click on Other users on the right.
  3. Expand the account affected by the error, and click the Change account type button.change account type
  4. Select Administrator from the Account type dropdown menu, and click OK to save the changes.administrator to fix ERROR_BAD_PATHNAME

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

Tip icon Tip
Since this method entails editing to the Registry Editor, I recommend creating a restore point beforehand, which will allow you to revert any untoward changes made inadvertently during the process.
  1. Press Windows + S to open Search, type Registry Editor, and click on the relevant result.
  2. Click Yes in the UAC prompt.
  3. Paste the following path in the address bar at the top and hit Enter: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Managersession manager registry
  4. Now, right-click on the empty space towards the right, hover the cursor over New, select DWORD (32-bit) Value, and name it ObjectSecurityMode.
  5. Double-click on the newly created DWORD.
  6. Enter 0 under the Value data field, and click OK to save the changes.ObjectSecurityMode DWORD to fix ERROR_BAD_PATHNAME
  7. Finally, reboot the PC and check for improvements.

6. Create a new user profile

  1. Press Windows + R to open Run, type netplwiz in the text field, and hit Enter.
  2. Click on Add.add account to fix ERROR_BAD_PATHNAME
  3. Click on Sign in without a Microsoft account.
  4. Now, click the Local account button.local account
  5. Enter the new profile’s username and password (not mandatory), click Next to create the account, and then click on Finish.user profile details
  6. Next, select the user profile from the list, and click on Properties.
  7. Go to the Group Membership tab, select Administrator, and click on Apply and OK to save the changes.administrator account to fix ERROR_BAD_PATHNAME
  8. 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

  1. Press Windows + S to open Search, type Create a restore point, and click on the relevant result.
  2. Click the System Restore button.restore to fix ERROR_BAD_PATHNAME
  3. Select the Choose a different restore point option, and click on Next.
  4. Pick a restore point created before the issue first appeared or the oldest one from the list, and click Next.restore point
  5. Verify the restore details, click on Finish, and confirm the change.
  6. 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.

More about the topics: System Errors

User forum

0 messages