When I open text documents, they immediately print?

1

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?

Anthony Mastrean

Posted 2011-01-18T20:52:26.173

Reputation: 525

Answers

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.

RedGrittyBrick

Posted 2011-01-18T20:52:26.173

Reputation: 70 632

I "open" a txt file by double-clicking on it or right-clicking and choosing Open. – Anthony Mastrean – 2011-01-19T15:09:51.163

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. – Anthony Mastrean – 2011-01-19T15:10:06.810

1Try ftype txtfile="%SystemRoot%\system32\NOTEPAD.EXE %1" – RedGrittyBrick – 2011-01-20T10:15:10.033

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! – Anthony Mastrean – 2011-01-21T15:43:59.730

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.

mir

Posted 2011-01-18T20:52:26.173

Reputation: 31

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. – None – 2011-11-12T22:42:35.397

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

.

Moab

Posted 2011-01-18T20:52:26.173

Reputation: 54 203

It is set to Notepad. – Anthony Mastrean – 2011-01-18T21:15:06.460

Does the test document open, then it starts printing? Try updating your printer software to the latest version. – Moab – 2011-01-18T21:16:50.093

How about changing it to another program like Wordpad, then setting it back to Notepad? – Martheen Cahya Paulo – 2011-01-18T21:19:18.123

I tried cycling the associated program, it auto-prints still. – Anthony Mastrean – 2011-01-18T21:22:55.823

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

Anthony Mastrean

Posted 2011-01-18T20:52:26.173

Reputation: 525