Red - 13 Aug. 2003 - 09:21:
New Trick - Make new files with starting template
I've been wondering how they do it, and I finally figured it out.

Now I can create a new file from the new menu, and it will start off containing data of my choosing. This means code files can start with headers, image fiels can start with water marks, and files that can't start with zero bytes can now be used.
It's a two part edit: registry and file.
In the registry, under the extention you need to create a new key with the control it points to. For example: a .bat (batch file) has the text "batfile" in a text string. There is a matching key that tells windows what to do with that file. The new key would have to be under .bat and labeled "batfile" to work. Next you need yet another subkey called "ShellNew". In there you create a text string called "newfile" and a value of the file name of the template you want.
The second half is simple. Create a template file and place it in the
hidden "c:\windows\shellnew" folder.
Now when you open the new submenu you can create (going with the eample) a new batch file with all the basic info one usually would need to redundantly type pre-existing.
Here is the registry key info:
REGEDIT4
[HKEY_CLASSES_ROOT\.bat\batfile\ShellNew]
"FileName"="start.bat"
Below is the code for a batch file installer to make the reg change and starter batch file.
@echo off
:Coder: CutTheRedWire

ate: 2003/8/12
:About: Adds a batch file entry to the "New File" menu with a custom template too
:REG FILE
:Create the registry file to be merged.
set newfile=%temp%\NewFile.reg
echo REGEDIT4>%newfile%
echo [HKEY_CLASSES_ROOT\.bat\batfile\ShellNew]>>%newfile%
echo "FileName"="start.bat">>%newfile%
:BAT FILE
:Create the batch file to be used as a template.
set start=C:\windows\shellnew\start.bat
echo @echo off>%start%
echo :Coder: CutTheRedWire>>%start%
echo

ate: //>>%start%
echo :About: App discription>>%start%
:USE REG FILE
:Runs the reg file to merge it
:Note that if it doesn't wait,
:the reg file is deleted before merging
start /w %newfile%
:CLEAR SYSTEM
:deletes the reg file and clears variables
del %newfile%
set newfile=
set start=
I did my best to make it well commented, and easy to read. Let me know if it makes sense. I figure it's an easy way to change such a thing later. I'm quick with batch files though.
Coding took about 10 minutes, and checking the registry about the same, but I had done research before. I has been tested though, and worked fine under 98. Check your paths and registry before running it. Not my fault if is messes something up.
Let me know what you guys think of the trick and the app.

Very nice, Red. Thanks for researching this! I can confirm that this works on XP, but the registry key is different (ShellNew rests under the .ext key). For example, .bat would be:
[HKEY_CLASSES_ROOT\.bat\ShellNew]
That works under 98 for new files only, but not for new files witha template. Can you confirm if it works with a template file and where "C:\path\shellnew" is in xp? Is it user specific?
I'm only on 98, so I can test this out.
Oh and thx.

The compliment is appreciated. I was kinda excited about finding this. The new menu was always a pain to me, but now I'm actually stating to like it. Rip out the crap, add something useful, and you got something cool.
I just hace another idea: a thing for a new extentionless file. Then it could be just about anything you want (esp text based).
One last tip (which I did a thread on before): there is not much need for a new url entry. Reason bing that a new shortcut is changed to a .url file if you simple place a url in the command line. Jus thtought I would reiterate that since it relates to the topic.
It works with templates, and without templates. But the FileName value is required either way, with no data meaning no template.
The 'blank' file could work out if you attempt to mimic .lnk's behavoir. If you delete the "Command" value under HKCR\.lnk\ShellNew, creating a new shortcut makes an extensionless file. I couldn't get a similar .dud filetype to work the same way, mind you...