File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Access Registry Entry through Java Script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Access Registry Entry through Java Script" Watch "Access Registry Entry through Java Script" New topic

Access Registry Entry through Java Script

Shweta Gulati

Joined: Apr 26, 2001
Posts: 15
Hi everyone,
I am totally lost. I want to access the value for registry entry(installpath) where my application is installed through Java script. How do I do it?
Thanks a lot,
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
this is an example form MSDN. You can look under Web Development\Scripting\Window Script Host
Windows script host should be installed on machine (it usually is).
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.RegWrite ("HKCU\\Software\\ACME\\FortuneTeller\\", 1, "REG_BINARY");
WshShell.RegWrite ("HKCU\\Software\\ACME\\FortuneTeller\\MindReader", "Goocher!", "REG_SZ");
var Key1 = WshShell.RegRead ("HKCU\\Software\\ACME\\FortuneTeller\\");
var key2 = WshShell.RegRead ("HKCU\\Software\\ACME\\FortuneTeller\\MindReader");
WshShell.RegDelete ("HKCU\\Software\\ACME\\FortuneTeller\\MindReader");
WshShell.RegDelete ("HKCU\\Software\\ACME\\FortuneTeller\\");
WshShell.RegDelete ("HKCU\\Software\\ACME\\");
[ August 19, 2002: Message edited by: Yuriy Fuksenko ]
I agree. Here's the link:
subject: Access Registry Entry through Java Script