Set environment variables using js

sponsored links
//  Debug function  
function show(msg)
wsh = new ActiveXObject("WScript.Shell");
// Perform  
//try {
// Debug("dkjkljei");
//} catch (e) {

wsh = new ActiveXObject("WScript.Shell");
 Gets the user environment variables  
 Set the user environment variables  
wsh.Environment("user").Item(name) = value;
 Delete user environment variables  
 Gets the system environment variables  
 Set the system environment variables  
wsh.Environment("system").Item(name) = value;
function addEnvVar(sys, obj, value) {
wsh = new ActiveXObject("WScript.Shell");
wsh.Environment(sys).Item(obj) = value;
function delEnvVar(obj) {
wsh = new ActiveXObject("WScript.Shell");
function getEnvVar(sys, obj) {
wsh = new ActiveXObject("WScript.Shell");
Set ws=WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(ws.CurrentDirectory)
Set fc = f.Files
For Each f1 in fc
   if right(,len(,"."))="reg" then "regedit /s """&""""
function showDir() {
var fso, f, fc, s;
wsh = new ActiveXObject("WScript.Shell");
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.GetFolder(wsh.CurrentDirectory);
fc = new Enumerator(f.files);
s = "";
var regValue = new RegExp(".java$","i");
for (; !fc.atEnd(); fc.moveNext()) {
  if (regValue.test(fc.item())) {
   var ff = fc.item();
   s += ff.Name;
   s += "\n";
var jdk = "d:\\java\\jdk";
function setJDK(obj) {
// Set  java_home
addEnvVar("system", "java_home", obj);
var path = getEnvVar("system", "path");
var pathbak = getEnvVar("system", "pathbak");
// Determine the existence of pathbak, not the Add  
if (pathbak == "") {
  addEnvVar("system", "pathbak", path);
// Set  path
addEnvVar("system", "path", path + ";%java_home%\\bin");

var cp, fso, f, fc, ff;
wsh = new ActiveXObject("WScript.Shell");
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.GetFolder(obj + "\\lib");
fc = new Enumerator(f.files);
cp = ".;";
var regValue = new RegExp(".jar$","i");
for (; !fc.atEnd(); fc.moveNext()) {
  ff = fc.item();
  if (regValue.test( {
   cp += "%java_home%\\lib\\" + + ";";
// Set  classpath
addEnvVar("system", "classpath", cp);
function run() {
wsh = new ActiveXObject("WScript.Shell");"regedit");

Set environment variables using js
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of Set environment variables using js

  • Msxml2.XMLHTTP version problem

    Projects with an import feature prototype.js of Ajax functionality to update the prompt, the code is very simple, do not have the framework of the background on a jsp to output Text, future use of timers and to update the page Ajax.request encountere ...

  • IBM Ajax Tutorial Series

    Links: Part 10: Using JSON for data transmission In the asynchronous application to send and receive information, you can choose to plain text and XML as data format. Ajax grasp of this issue ...

  • jquery ajax example

    1. Check js file $. ajax (( type: "GET", url: "test.js", dataType: "script" )) data $. ajax (( type: "POST", url: "xxxx", data: "name = zhaoaiqing & age = 25", success: function ( ...

  • eclipse Hibernate proposals

    Error: The 'Hibernate proposals' proposal computer from the' org.hibernate.eclipse.jdt.ui 'plug-in dod not complete normally. Unable to instantiate the extension. To Avoid this message, disable the 'org.hibernate.eclipse.jdt.ui ...

  • Strength of live practice teaching materials, suitable for each person team look - UFIDA Hua Table CTO talk about "out of the software factory"

    A few months ago, on reading "Going the software factory," one book, not yet published at that time, it can be considered the reference of the watch. Although the language rather uneventful, but the contents of people really can not but carry on

  • Workspace run under different Eclipse

    Now do live more and more often required to use eclipse in java and ruby & rails project conducted between the tangential shear from the past, because in the rails project used a coloring Aptana preferences, the results open the java project sour ...

  • Software development sunflower Baodian [reprint]

    Master the ability to reuse code very familiar with the new API's fast. This is because, he once used a lot of the API, have a lot of reusable code. He knows what is available and what is deficient. He has been using Qt, also used by gtk +, also used

  • hibernate (jpa) composite primary key annotation statement Ways

    In the design of the database tables are designed with a composite primary key of the table, that table's record by more than one field joint identification, such as: Table CREATE TABLE TB_HOUR_DATA ( STAT_DATE DATE NOT NULL, PATH_ID NUMBER(20) NOT NULL,

  • can not be represented as java.sql.Timestamp

    Development of procedures for the use of hibernate when, some time there is no need to fill in the fields, but after the hibernate query time reported "Java.sql.SQLException: Value'0000-00-00 'can not be represented as java.sql.Timestamp ...

  • Struts2 + hibernate + spring problem user log in

    dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q

blog comments powered by Disqus
Recent Entries
Tag Cloud
Random Entries