PDA

View Full Version : سوال: تغییر رجیستری ویندوز با جاوا



mahdi68
سه شنبه 13 اسفند 1387, 21:47 عصر
با سلام خدمت تمام دوستان گلم :قلب:
من تو برنامم احتیاج به این دارم که به رجیستری ویندوز دسترسی داشته باشم و اونو تغییر بدم لطفا راهنماییم کنین چه جوری باید این کار انجام بدم ؟؟؟:لبخندساده:

mahdi68
پنج شنبه 15 اسفند 1387, 18:12 عصر
چرا کسی جواب من نمیده ؟؟؟
لطفا کمکم کنید

saeedIRHA
پنج شنبه 15 اسفند 1387, 23:08 عصر
چرا کسی جواب من نمیده ؟؟؟
لطفا کمکم کنید

اگر نخوای Native کد بنويسی تنها راه حلی که ميتونم پيشنهاد کنم
استفاده از Reg.exe خود windows هست و اونو از طريقه برنامه جاوا ت call کنی
برای طرز استفاده از Reg به لينک زير مراجعه کن:
http://commandwindows.com/reg.htm
با خواندن اين سورس کدم هم ميتونی ببينی چطوری ميشه يک command در windows رو صدا زد:



import java.io.*;
public class ConsoleOutputToFile
{

private final static String command = "cmd.exe /c dir"; //can be any command

public static void main(String[] args) throws IOException
{
System.out.println("[+]Creating Output File.");
File myFile = new File("output.txt");
System.out.println("[+]Running Command: " + command);

//running the process
Process p = Runtime.getRuntime().exec(command);

System.out.println("[+]Obtaining Console Output Pipe");
//Console output pipe from the running process
BufferedReader stdin = new BufferedReader(new InputStreamReader(p.getInputStream()));
System.out.println("[+]Obtaining File Input Pipe.");
//input pipe to the text file
BufferedWriter out = new BufferedWriter( new FileWriter(myFile));

String input ="";
System.out.println("[-]Writing to file: " + myFile.getName());
while((input = stdin.readLine()) != null)
{
out.write(input + "\r\n"); // \r\n windows type new line :-)
//flushing the buffer
out.flush();
}
out.close();
System.out.println("[-]Terminating application.");
}
}


موفق باشی

mahdi68
شنبه 17 اسفند 1387, 23:07 عصر
دوست خوبم میشه یکم جزئی در مورد کد بالا برام توضیح بدی ؟؟؟!!!متشکرم