how can i create batch file means a file with extention .bat .So that i can create system file....
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
how can i create batch file means a file with extention .bat .So that i can create system file....
Refer to the Oracle Tutorials that discuss IO (Input/Output) and writing to files.
will u discribe it properly.....?
It is described properly at the topics I referred you to. Search for "java io tutorial", and the top result should be the one you need.
If you're planning on using it for Miscellaneous reasons then it would be harder. I read somewhere that Java doesn't allow remote code to read or write files to the filesystem. If you was thinking of a way to write a java program that wrote a .bat file that created a executable on the registry it would be very difficult. If it's just on your local PC it's easier to do with the java.io.*
PrintWriter writer = new PrintWriter("the-file-name.bat", "UTF-8");
writer.println("start cmd.exe");
writer.println("writes text to a file, so batch commands would go here");
writer.close();
I haven't tested this code btw, but it should work. I'll probably code something in a second and test it for you.
If you have any projects you wanted to work on. Message me at my skype. shadow.byte
mention episode no.....
I've coded a program that will Create a .bat file, and write a start command to it to start CMD. Then I made the program use batch to open the file.
Here is the source code
#98C9fDJpBp - Mystic Paste
Also, if you're trying to find a path name, and need a CurrentUser pathname, I think you can do something like this.
C:\\Users\\%CurrentUser% or maybe It's C:\\Users\\%UserProfile%\\workspace etc, idk. You'll have to play with it.
If you have any projects you wanted to work on. Message me at my skype. shadow.byte