1

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?

4 Answers 4

6

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.

4
  • I "open" a txt file by double-clicking on it or right-clicking and choosing Open. Jan 19, 2011 at 15:09
  • Here's the output of the commands you noted... c:\>assoc .txt => .txt=txtfile AND c:\>ftype txtfile => File type 'txtfile' not found or no open command associated with it. Jan 19, 2011 at 15:10
  • 1
    Try ftype txtfile="%SystemRoot%\system32\NOTEPAD.EXE %1" Jan 20, 2011 at 10:15
  • YES! that last command set the ftype (I checked with the command 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
3

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.

1
  • This answer of deleting the registry key and then opening Notepad worked perfectly for me. All I would say is make sure it is the txtfile you delete, not the txt one.
    – user105172
    Nov 12, 2011 at 22:42
0

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

.

4
  • It is set to Notepad. Jan 18, 2011 at 21:15
  • Does the test document open, then it starts printing? Try updating your printer software to the latest version.
    – Moab
    Jan 18, 2011 at 21:16
  • How about changing it to another program like Wordpad, then setting it back to Notepad?
    – Martheen
    Jan 18, 2011 at 21:19
  • I tried cycling the associated program, it auto-prints still. Jan 18, 2011 at 21:22
0

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>"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .