Every time I open a text (.txt) document on my PC (Windows 7 Ultimate x64), it immediately begins printing on my default printer.
What is happening and how do I turn it off?
Perhaps you have something like a /p
in the file association since running notepad /p filename.txt
will immediately print the file on the default printer.
C:\>assoc .txt .txt=txtfile C:\>ftype txtfile txtfile=%SystemRoot%\system32\NOTEPAD.EXE %1
Of course this depends on exactly how you "open a text (.txt) document", For example, if you mean you run MS Word and use it's File, Open
dialogue, you probably have a different problem.
EDIT
assoc
and ftype
provide an incomplete means of editing registry entries. My PC has under HKEY_LOCAL_MACHINE\SOFTWARE\Classes
\txtfile\shell\open\command %SystemRoot%\system32\NOTEPAD.exe %1"
\txtfile\shell\print\command %SystemRoot%\system32\NOTEPAD.exe /p %1"
(The key name and type are (Default)
and REG_EXPAND_SZ
respectively.)
There may have been some incorrect values (or missing entries) that cause the described problem.
Using ftype
and assoc
to attempt to correct this obviously carries fewer risks than editing the registry directly.
ftype txtfile
) and when I opened a txt file, Windows asked me to associate it with a program. I chose Notepad. and it opened normally!
Jan 21, 2011 at 15:43
Delete this key from the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\txtfile\
Right click on a .txt file, choose Open With > Notepad. All will be okay.
txtfile
you delete, not the txt
one.
Go to Control Panel (icon view) Default Programs, then click "associate a file type or protocol with a program"
Scroll down to .txt , it should be associated with Notepad, is it?
If it is not, double click it and select Notepad
.
I had the same problem on my home PC (what's going on!?) and the FTYPE command that RedGrittyBrick suggested did not work this time. I had to modify the registry manually. I had to modify the type of the registry key using the command line.
reg.exe add <key> /ve /t REG_EXPAND_SZ /d "<value>"