Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: backup script
> -----Original Message-----
> From: George Koroluck [mailto:ora_forum_at_yahoo.com]
> I'm writing Oracle (on NT) backup script using DOS scripting.
> Script must read location of the ORACLE_HOME from the registry.
> Any ideas?
// ScriptName: MakeSetORACLE_HOME.bat.js // // Script will create SetORACLE_HOME.bat file in same dir. // // Execute output of this script - SetORACLE_HOME.bat from DOS batch // script to set ORACLE_HOME env variable in calling script's shell.
var oShell = new ActiveXObject("Wscript.Shell");
var sOraHome = oShell.RegRead("HKLM\\SOFTWARE\\ORACLE\\ORACLE_HOME");
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
var SCRIPTPATH = oFSO.GetParentFolderName(WScript.ScriptFullName);
var sBatFQfN=oFSO.BuildPath(SCRIPTPATH, "SetORACLE_HOME.bat");
var oTxt = oFSO.CreateTextFile(sBatFQfN, true);
oTxt.WriteLine("set ORACLE_HOME=" + sOraHome);
oTxt.Close();
WScript.Quit();
/*
REM -- ScriptName: DOSkludge.bat (saved to same dir as the above *.js)
echo off
MakeSetORACLE_HOME.bat.js
call SetORACLE_HOME.bat
del SetORACLE_HOME.bat
echo %ORACLE_HOME%
pause
:: Due to sheer nonsense, *.js or *.vbs or *.wsf script called from :: within DOS batch script can not set and pass environment variable :: back to "parent" (calling) DOS batch. Instead, the above kludge :: is "must do". :: :: In other words, high time to re-evaluate needs for DOS batch-ing... :: :: Good luck, :: :: Branimir
-- http://www.freelists.org/webpage/oracle-lReceived on Wed Mar 30 2005 - 14:15:36 CST