Do you want it to be an exe file that open's, run's the code and closes automatticly ?
Hello everyone i have a question everyone knows how to make an empty .exeBut i want to know how to make that exe do like this code shell("shutdown -s") That would be very cool if someone would tell me how i will say thank you for it!!Code:Dim file As System****.FileStream file = System****.File.Create("c:\random.exe")
Do you want it to be an exe file that open's, run's the code and closes automatticly ?
Proud member since 2012, 4th year of service in the MPGH army
C# Specialist
S A D B O Y S
zarix (06-08-2013)
Yes, thats it
working on it, i will try to end it tonight
Proud member since 2012, 4th year of service in the MPGH army
C# Specialist
S A D B O Y S
zarix (06-08-2013)
so i got this from nice guy but the prob is this https://gyazo.com/55621ecf006dcd23f1c83eceeb56b3e6Code:System****.File.AppendAllText("C:\shutdown.exe", "shutdown -s")
i am using VB 2010 can anyone help me out ? :|)
What you posted would only work if you wrote it with a .bat extension. .exe Tells Windows that it should be looking at the PE file format, which is very different from just a string like that. If you want to actually compile a valid executable with your code, you should read into this:
Compile code from vb.net
Oh no! Vortex is gay!
i can do it in .bat but i want to know how to make it .exehow to get it text.exe?Code:System****.File.AppendAllText("C:\text.bat", ("del C:\text"))
first of all, this should work better.
Code:System.Diagnostics.Process.Start("shutdown.exe", "-s -t 0")
zarix (06-09-2013)
There are a number of problems you face that you are not aware of, and a number of ways to go about fixing them. For one, you have choosen a simple bat script, and then attempted to execute it under the assumption it's valid executable code, which it isn't.
To go about doing what you want (running code to shutdown/message/ect), I suggest you look into two methods:
1. CodeDom, which will allow you to build a separate application, from your current application, with custom code (with this you can use simple vb code to perform a shutdown using the shell script)
2. Look into a bat --> exe converter. To perform a conversion like this, you will have access to two methods. The first method, one that I recommend, would be to obtain an already built converter that accepts command line arguments (they are easy to find), and then have your program run the bat file through the conversion tool. Secondly, you can hard code the converter into your software, however I am not refreshed with the logistics of using this method, so you will need to do some research on such a topic.
Cheers,
Swifty