“How do you want to open this file” Pops Up at Startup

Symptom: Every time you log in to your user account, the “How do you want to open this file?” (aka, the “Open with” dialog) dialog may appear.

open with dialog appears during login

(Go directly to the Solution ↓)

If you select Notepad from the list and click OK, it may open a log file that has contents similar to the following:

[50CC:3DD8][2022-07-07T21:30:58]i001: Burn v3.10.4.4718, Windows v10.0 (Build 22000: Service Pack 0), path: C:\WINDOWS\Temp\{0AFB5279-0CBB-411A-8561-1EC21318DAA4}\.cr\VC_redist.x64.exe

[50CC:3DD8][2022-07-07T21:30:58]i009: Command Line: '-burn.clean.room=C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.VisualCpp.Redist.14.Latest,version=14.32.31332,chip=x64\VC_redist.x64.exe -burn.filehandle.attached=552 -burn.filehandle.self=556 /q /norestart /log C:\Users\Mario Jose\AppData\Local\Temp\dd_setup_20220707212329_554_Microsoft.VisualCpp.Redist.14.Latest.log'

[50CC:3DD8][2022-07-07T21:30:58]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.VisualCpp.Redist.14.Latest,version=14.32.31332,chip=x64\VC_redist.x64.exe'

[50CC:3DD8][2022-07-07T21:30:58]i000: Setting string variable 'WixBundleOriginalSourceFolder' to value 'C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.VisualCpp.Redist.14.Latest,version=14.32.31332,chip=x64\'

[50CC:3DD8][2022-07-07T21:30:58]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\Mario'

[50CC:3DD8][2022-07-07T21:30:58]i000: Setting string variable 'WixBundleName' to value 'Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.32.31332'

One other systems, opening the “unknown” file using Notepad via the Open With dialog shows the following content:

Usage : fsutil behavior query <option>

<option>

AllowExtChar
BugcheckOnCorrupt
Disable8dot3 [<Volume Path>]
DisableCompression
DisableCompressionLimit
DisableDeleteNotify [NTFS|ReFS]
DisableEncryption
DisableFileMetadataOptimization
DisableLastAccess
DisableSpotCorruptionHandling
EncryptPagingFile
MemoryUsage
MftZone
QuotaNotify
SymlinkEvaluation
DisableWriteAutoTiering [<Volume Path>]
DisableTxf [<Volume Path>]

Please use "fsutil 8dot3name query /?" for more information.

For DisableDeleteNotify if neither "NTFS" nor "ReFS" is specified, both values are shown.

Additionally, the “How do you want to open this file?” or the “Open with” dialog may also appear when you run one of the following environment variables:

  • %USERPROFILE%
  • %APPDATA%
  • %LOCALAPPDATA%

And the same issue may occur when you use the Run dialog to launch files located in your user profile folder, such as:

  • C:\Users\Ramesh Srinivasan\Desktop\MonOff.Bat

Cause

The above symptoms occur if an extensionless file with the same name as your first name (or the first word of your profile home folder name) is located under the C:\Users directory. This issue occurs only on user accounts whose home folder name contains one or more spaces.

In the above VC++ Redist log file, it’s clear that a (log) file named “Mario” exists in the C:\Users directory, whereas the user profile folder name is “Mario Jose.” The log file was created by the Microsoft Visual C++ 2015-2022 Redistributable (x64) installer.

The VC++ installer has a bug wherein it didn’t enclose the log file path within double quotes, which caused the following file to be created:

C:\Users\Mario

Instead of:

C:\Users\Mario Jose\AppData\Local\Temp\dd_setup_20220707212329_554_Microsoft.VisualCpp.Redist.14.Latest.log

As the user name contains one or more spaces, the Operating System created a file named “Mario” in the C:\Users directory without resolving the full path.

In the above situation, the “Open With” dialog appears on the screen during the following situations:

  • A startup entry in the registry points to a file inside the User profile folder, and the startup entry is not enclosed within double quotes. This triggers the launch of the “Open With” dialog to open the extensionless file.
  • Whenever you run %USERPROFILE%, %APPDATA%, %LOCALAPPDATA%, or launch a file in your user profile (e.g., C:\Users\Backup User\Desktop\Launch.bat) using its full path (without using double quotes), the same issue occurs.

In the second case (Fsutil log), some app seems to have run the following command and piped the output to a file under C:\Users\%username% in the same way, without enclosing the destination path within double-quotes.

fsutil behavior query

Another Example

For instance, if your user account name is “Backup Master” and a blank file named “Backup” exists in the C:\Users directory, it causes the problem.

When you open the Task Manager → Startup tab, you can see that the Operating System resolves the path incorrectly. As you can see in the “Command line” column, the OS ignores the rest of the folder path that appears after the text “C:\Users\Backup”.

open with dialog appears during login

In the Registry Editor, the Run registry key points to a file named: “Launch.bat” in the user’s Desktop directory.

open with dialog appears during login

The OS takes the partial path because the entry is not enclosed within double quotes.

Solution

To resolve the issue of the “How do you want to open this file” Dialog opening at login or during other situations explained in the “Symptoms” section, follow these steps:

Step 1: Delete the extensionless file from C:\Users

Open the C:\Users folder and delete the extensionless file with the same name as the first word of your user profile home folder.

open with dialog appears during login

This stops the Open With dialog from being triggered by a registry startup/Run key.



Step 2: Enclose the Registry value within double quotes

Launch the Registry Editor (regedit.exe) and go to the following branches:

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

tips bulb iconTip: From a branch under HKEY_CURRENT_USER, you can jump to the parallel key under HKEY_LOCAL_MACHINE (and the other way) by using the “Go to HKEY” context menu. See the article Switch between HKCU and HKLM quickly in RegEdit for more information.

Double-click each entry whose value data doesn’t contain double quotes.

Enclose the existing value data within double quotes, and click OK.

open with dialog appears during login

You can now see that the OS/Task Manager → Startup tab resolves the path correctly!

open with dialog appears during login

Also, the startup item’s name is now correctly formed – “Launch” instead of “Backup”.

After performing the above steps, the “Open with” dialog shouldn’t appear at Startup. However, you may also need to check if a Task Scheduler Startup task is triggering the “Open With” dialog, and if so, edit the task and fix the path accordingly.

(For some reason, on Windows 10/11 systems, the Startup folders don’t trigger the “Open With” dialog even if the shortcut target is missing double quotes. Only the startup Registry entries or Task Scheduler Startup tasks seem to cause this issue.)


Step 3: Rename your User Profile Folder (Optional)

While the above methods help you stop the unwanted “Open with” dialog from appearing at startup, the fundamental issue remains: your user profile folder name contains one or more spaces in it. A poorly coded program or installer may repeatedly create a file under “C:\Users” by not enclosing the path within double quotes.

Also, if the home folder name contains space(s), you must enclose the file paths within double quotes, whether you run it from a Batch file, Script, or via the Run dialog. Example:

"%APPDATA%"

"%LOCALAPPDATA%"

"%USERPROFILE""

"C:\Users\Ramesh Srinivasan\Desktop\Launch.bat"

Enclosing the commands or paths within double quotes is the best practice. However, doing it every time to launch a file or folder is a headache, especially in the long run.

Ultimate Fix

To fix this issue permanently, you may create a new user name (without a space) or rename the existing user profile folder (e.g., from “Ramesh Srinivasan” to “Ramesh”) via the registry.

Renaming the user profile folder name in the registry has to be done cautiously. Please go through my detailed article How to Rename User Profile Folder in Windows 10/11. Also, please have appropriate backups (preferably a full image backup using Macrium Reflect Free) in place before trying the rename procedure.

Editor’s Note: The screenshots in this article are from a computer running the latest Windows 11 Insider Build. That’s why the Task Manager’s Startup tab looks different than the one in Windows 11 version 21H2.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

Leave a Comment