Jump to content

New-File Menu, predefined file contents


Recommended Posts

This is something I found very useful.

It is possibly to define your own new-file types like this:

[HKEY_CLASSES_ROOT\.cmd\ShellNew]
"NullFile"=""

This for example creates a empty cmd-file when using the New-File menu.

The best part is, you can let windows copy a existing file to a new file you create using that menu. The code then becomes:

[HKEY_CLASSES_ROOT\.cmd\ShellNew]
"FileName"="c:\\windows\\system32\\cmdnew.dat"

Now create the cmdnew.dat in the system32 folder, and put anything you like in it. In example, i have by default @echo off in it.

This is also useful for .reg file, where i put the Windows Registry Editor Version 5.00 by default in the newly created file.

Note: Enviromental Variables like %windir% unfortanetely don't work!

Link to comment
Share on other sites


hmmmm...while this is good info...this has been discussed...I dont remember where its at...but for shellnew cmd file, I have this...

[HKEY_CLASSES_ROOT\.cmd\ShellNew]
"Nullfile"=""
"Data"=hex:40,45,43,48,4f,20,4f,46,46,0d,0a

Which puts @echo off and a new line in a new cmd file...Ive done this for many things....reg has 2 line feeds, .bat is same as .cmd, .html has some info in it as well...I personally believe "Data" is the best way to go, for one, you dont need to add a single file, its all contained in the registry...and as you can see, my "data" is reg_binary...you may want to figure out how to change "FileName" data into a reg_expandsz value...

Link to comment
Share on other sites

yea, its not too bad...actually, put that into a reg file...(using your method is fine, just create a new reg file, and paste the stuff in there) now, right click on data and "modify binary data" then you can see what it is....then I create a temp key...type in what I want it to say, and click "modify binary data and get the hex values. the only thing about this is there is almost NO way to figure out what the ENTER key value is...it is 0d 0a (yes, you need both dunno why) so everytime you want a new line, just type in 0d 0a. One thing you could do is create a new string value, and type in every letter and itll tell you the values...just remember upper and lowercase have different values, but it shouldnt matter

Link to comment
Share on other sites

Thanx, found it out already.

And I know why you need both. And ENTER on Windows is 2 ASCII characters, one for CariageReturn, and one for LineFeed. Linux files for example need only one character. (LineFeed).

Anyway, now you can make some pretty funny things. Like putting the hex-codes of a complete program or something under .exe extension (or whatever, you can always rename it). Or a complete picture (.bmp / .jpg) LOL :lol:. This way you can hide some files nobody would ever notice.

Link to comment
Share on other sites

The Data-value can be a REG_SZ, so you don't have to work with hex values. I tried to make it a REG_MULTI_SZ (to have multiple lines), but it just put all the lines on one line :( I think you're better off with a predefined file if you want to have multiple lines.

Edit1: btw, you don't need the NullFile-value in there. It will show up in the New-list anyway if you just put in the Data- or FileName-value.

Edit2: I'd still go for the predefined file. If you use the Data-value, it will add a character (not sure what character, it shows up as a space in Notepad) to the end of your string.

Link to comment
Share on other sites

tsunami, youre doing something wrong...there are no spaces in any of my files unless i put them there (like between ECHO and OFF). The reason it has to be binary is so you can have multiple lines...which might be why youre having a problem. I guess you didnt read what I wrote.

Link to comment
Share on other sites

it really isnt that bad...like I said, what I do is create a reg_sz key and type in all the data...not using anything but spaces...so like for html, the reg_sz would read...

<html><head><body>

I would then rightclick and select modify binary data...and get the values, then after the > I would add a 0d 0a since I want it on a new line...notice I used no spaces for enter keys, because that could mess you up when reentering...or, you could make a file, with the data you want, and hex edit it...that should get you the values also.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...