Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When i double click a text document, if that text file is more than 1MB(or some specified size) I want that text file to be opened in Notepad++ while the files that are smaller should be opened in notepad itself.

Is there any way i can achieve this.? Thanks

share|improve this question
why oh why? is notepad++ not able to open files larger than X? – akira Mar 21 '10 at 17:47
no. i just want the larger files to be opened in Notepad++ while the smaller files like having just a few lines of text to be opened in Notepad itself. – SyncMaster Mar 22 '10 at 13:40
I think notepad has a 2mb limit. Anything past that and it stops responding. I feel your pain pragadheesh... I'm used to opening 60MB log files in notepad and waiting up to 10 minutes for notepad to start responding again. – Sakamoto Kazuma Mar 22 '10 at 14:43
Is there any reason you just don't always use Notepad++? – heavyd Mar 23 '10 at 0:34
up vote 6 down vote accepted

(Upfront caveat: this isn't a perfect answer to your question, but it seemed useful/interesting enough to share.)

If you save the following text to a file with an extension of .bat or .cmd (e.g. runconditional.cmd):

@echo off
if %~z1 LSS 1048576 (
    notepad.exe %1
) else (
    c:\my\path\to\notepad++.exe %1

...then you should be able to use it to launch different programs depending on the size of a file. (I put 1048576--the number of bytes in a megabyte--in the script, but you can replace that with a number of your choice or even turn that into a second parameter of the script.) Example usage would be something like:

runconditional.cmd c:\mysmallfile.txt

(You can run this from a Command Prompt or from Start...Run.) The next step would be for you to associate this script with the files of your choice. I'm not sure offhand if you can directly associate a file type directly with a script, but at the least you'd be able to associate it with:

cmd.exe /c c:\path\to\runconditional.cmd

One possible downside to this approach is that you may see a console window flash on the screen between double-clicking the file's icon and seeing notepad (or notepad++, or...) launch.

share|improve this answer
+1 for the geekish-heck-i-do-it-myself-solution – akira Mar 23 '10 at 6:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.