Running exe file behind a txt file

bugs99 picture bugs99 · Jul 25, 2012 · Viewed 7.9k times · Source

Was reading about ADS(Alternate data streams) in windows, so came across this thing. Working on Windows XP to test the following.

I created a file with name - sample.txt with the content - "hello there" Created another file with name - second.txt with content - "I am hidden"

At command prompt did the following:-

type second.txt > sample.txt:newfile.txt

It executes successfully

Now, if i type this:-

notepad sample.txt:newfile.txt

Notepad opens newfile.txt with the content - "I am hidden"

Till here, its normal

Now, I tried to hide an exe file,lets say - notepad.exe behind a txt sample like this:-- (i have copied notepad.exe in the same folder)

type notepad.exe > sample.txt:newexe.exe

Above command runs successfully.

Question is, now how can i run that exe file which is now behind text file. My guess is I need some form of interpreter (like notepad.exe in the first example) to make my exe run. Does exe files require some sort of interpreter to run(like text files need some editor)?? I know, exe files can be run directly, but here in this case thats not working. Even tried:--

start second.txt:newexe.exe

but it doesnt work. Help will be greatly appreciated, as I dont know much about windows internals.

Answer

Alex K. picture Alex K. · Jul 25, 2012

Sensibly, Windows will not allow this and will throw an Access Denied if you try to execute it, similarly there is no easy way to copy a binary stream.

With administrative privs you can mklink blah.exe sample.txt:newexe.exe which would create a symlink to the executable ADS, executable via blah.exe.