7 replies
by bfilmfan
You can output the path to a text file with the command:
path > directory\filename
Example:
path > c:\temp\path.txt
Then in your script, you could call that text file as a set of variables.
by zengeek
I tried something similar but was unable to change the path in a satisfactory manner. My scripts always run in a shell and the shell's path changes, but not the system path.
by has
Hi
I encountered and solved this problem a couple of years ago, when we cahnged to Windows XP, and needed a centralized solution, without visiting all macines (we have only 500, but still it's too many).
The rest of my Oracle-client installation was based on batch commandprompt scripts, so I wanted a solution in that "frame".
The problem with the path i commandprompt is it consist of BOTH the user-path and the system-path. And changing the path in commandprompt, don't change the machines systempath.
Well, the solution was this script:
rem Installation-script for update of system-path
rem
rem Hans Henrik Andersen, 20. februar 2003
REM *** Extract from registry to local environment
set TEMPFIL1=%TEMP%\OraPath.txt
set TEMPFIL2=%TEMP%\OraPath.bat
reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path >%TEMPFIL1%
java -cp "C:\DStHomeSel" RegToEnv "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" Path SystemPath <%TEMPFIL1% >%TEMPFIL2%
call %TEMPFIL2%
del %TEMPFIL1%
del %TEMPFIL2%
REM *** Remove "'s from SystemPath
set SystemPath=%SystemPath:"=%
REM *** Operations on SystemPath
REM *** Example: Remove java 1.1.7 from SystemPath
set SystemPath=%SystemPath:;C:\Programmer\Oracle\jre\1.1.8\bin=%
set SystemPath=%SystemPath:C:\Programmer\Oracle\jre\1.1.8\bin;=%
set SystemPath=%SystemPath:C:\Programmer\Oracle\jre\1.1.8\bin=%
REM *** Change system-path for machine
setx.exe Path "%SystemPath%" -m
I don't know where the setx program is from, some guy from our net-support gave it to me.
Short it changes the environment for windows globally (and not the local environment). The -m switch tells setx to change the systems environment, not the users.
It uses a java program for decomposing the output form the reg query command into a "set SystemPath=***" command. It is simple, but too long for the length limit here.
Hans Henrik
by zengeek
I actually found a simpler solution using Pathman.exe from the Windows Resource Kit and a batch file.
First, here a couple of things to remember:
1. The Windows registry stores Windows Path elements as %SYSTEMROOT% instead of "C:\Windows" for XP or "C:\WINNT" for Win2k.
2. Calling up the path from a shell or batch file expands these variables.
3. A shell's path environment is not affected by the pathman.exe utility and will remain unchanged unless you use the set command within that shell, and changes are only in effect till you close the shell.
Here is the script I used:
REM************************************
@echo off
pathman.exe /rs "%path%"
rem Old path removed
pathman.exe /as "%path:ora81=ora92%"
rem New path added
rem Now to remove path reduncies...
if %SYSTEMROOT%==C:\WINNT GOTO WIN2k
rem This is for WIN XP
pathman /rs "C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\system32\nls;C:\WINDOWS\system32\nls\ENGLISH;"
rem Path redundancies removed...
GOTO END
:WIN2k
pathman /rs "C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\WINNT\system32\nls;C:\WINNT\system32\nls\ENGLISH;"
rem Path redundancies removed...
:END
REM************************************
The basic system path is preserved in the registry because all variables are expanded when calling %PATH%.
%PATH% allows for variable substition in WinXP and Win2K which allowed me to modify the path with the new Oracle home when I used pathman to write back the path to the registry.
Removing explicit Windows path elements was required because %PATH% expands the variable %SYSTEMROOT% from the registry, causing double entries for "C:\Windows\System32"...
I hope that makes sense to you, because it worked for me for both Windows XP and 2000.
by softcorp.us
Hello Zengeek,
I have a tool that is ideal for your situation:
Softcorp scPATHMAN - System and User Path Management Tool
http://www.softcorp.us/scpathman
If you have any questions, please feel free to contact me.
-----Steve Jackson
CEO/CSA
Software Corporation (Softcorp)
by zengeek
I'll have to try it out, but I used my own solution as follows...
I actually found a simpler solution using Pathman.exe from the Windows Resource Kit and a batch file.
First, here a couple of things to remember:
1. The Windows registry stores Windows Path elements as %SYSTEMROOT% instead of "C:\Windows" for XP or "C:\WINNT" for Win2k.
2. Calling up the path from a shell or batch file expands these variables.
3. A shell's path environment is not affected by the pathman.exe utility and will remain unchanged unless you use the set command within that shell, and such changes are only in effect till you close the shell.
Here is the script I used:
REM************************************
@echo off
pathman.exe /rs "%path%"
rem Old path removed
pathman.exe /as "%path:ora81=ora92%"
rem New path added
rem Now to remove path reduncies...
if %SYSTEMROOT%==C:\WINNT GOTO WIN2k
rem This is for WIN XP
pathman /rs "C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\system32\nls;C:\WINDOWS\system32\nls\ENGLISH;"
rem Path redundancies removed...
GOTO END
:WIN2k
pathman /rs "C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\WINNT\system32\nls;C:\WINNT\system32\nls\ENGLISH;"
rem Path redundancies removed...
:END
REM************************************
The basic system path is preserved in the registry because all variables are expanded when calling %PATH%.
%PATH% allows for variable substition in WinXP and Win2K which allowed me to modify the path with the new Oracle home when I used pathman to write back the path to the registry.
Removing explicit Windows path elements was required because %PATH% expands the variable %SYSTEMROOT% from the registry, causing double entries for "C:\Windows\System32"...
I hope that makes sense to you, because it worked for me for both Windows XP and 2000.
by zengeek
This discussion is closed to new replies.
Trending Software posts
Sort by Trending