Sadly I've got no C++ installed and now I need a very simple program. I don't want to install it because it uses a huge amount of space and currently I've got only 2Gb left on the windows partition (Win7). So, could anyone compile me this exe? Here's the only thing I want:
A simple exe which starts another exe in the SAME folder. The other exes name is moch.exe. No other thing, just this one.
A minimal Cygwin installation with just gcc and what it needs should take a lot less than 2GB.
Or you could just make a simple batch script for that task
Simple batch isn't good for me cuz I can't convert it to exe. I doN't really know what 'Cygwin' is, but if you can help me how to write it I would install it :)
And why I want it? I think now you ask it. Currently I'm using a script language, called AutoIT. The exe of the AutoIT is not protectable, however, I've got some other ideas this is why I need the exe written in a common laguage.
There you go. It's pretty simple but will do the trick.
One thing I will say; you should be careful when asking around for someone to make you an exe. If you head to the wrong forum, no doubt someone will send a virus your way.
In light of this, I feel obligated to provide the source code for this file, so here it is:
EDIT: The indentation screwed up a bit on the code there and I'm too lazy to fix it. Also, this needs to be run from the directory where the moch.exe file lives.
Cheers Shadow. Not sure what you mean about determining the directory though. Can you elaborate? I'll be happy to amend to code and chuck up a new version.
Well, my english spelling isn't good -.-
I mean the process call will fail if the file system has another working directory registered as currently active instead of the application ones.
We can extend your code to something like that:
1 2 3 4 5 6 7 8
std::string app = argv[0]; // here we take the directory of our app - so we need an extra function to extract only the directory at this place ...
if(app.c_str()[app.size() - 1] != '\\') // adding trailing backslash
app += '\\';
app += "moch.exe"; // our target process call
if( !(CreateProcess(L(app),
L" ", 0, 0, false,
CREATE_DEFAULT_ERROR_MODE, 0,0,
&sinfo, &pinfo )))