1.

Solve : Command (.cmd) file help?

Answer»

I have recent been teaching myself how to create command files and am in of need some expert assistance.
My problem is that I am trying to come up with a simple way to add a missing sting to the end of the 'PATH' key at:-
HKLM\System\CurrentControlSet\Control\Session Manager\Environment\Path

Without replacing what is already there as this can vary on a number of different WORKSTATIONS on the network.

This is what I have come up with so far to check the 'Path' key:-
------------------------------------------------------------------------

echo off
cls

if {%1}=={} GOTO Syntax

reg query "HKLM\System\CurrentControlSet\Control\Session Manager\Environment\Path" \\%1
echo.

Goto End

:Syntax
echo Displays a listing of the REGISTRY key which contains
echo the data value for the Path setting.
echo.

echo Usage: CHECKPATH [computername]
echo.
goto End

:End
------------------------------------------------------------------------

and that's all good.
Now what I need to know is how add ;C:\APPS\IBLOCAL\BIN; without replacing whats already in there.
i.e using the reg update string.

Can any body help me?path=c:\winnt\;c:\
prompt=$p$g
path=%path%;c:\winnt\system32\msresourcekit\;
set temp=c:\winnt\temp
ver


Above shows example of appending to environment with PATH commandThanks for the reply, but it's not REALLY what I am after.
I want to apply this so it works when I use it to update a remote workstation.
I know how to update one LOCALLY just not remotely.

Is there a way to use the pathman.exe command to do this remotely. e.g.

pathman /as ;C:\APPS\IBLOCAL\BIN;

Can I somehow get this above command to launch on a remote workstation?It's all good. I managed to find a way myself.
reg update "HKLM\System\CurrentControlSet\Control\Session Manager\Environment\Path=%PATH%;C:\APPS\IBLOCAL\BIN;" \\%1

This works on remote workstations.
Thanks anyway...



Discussion

No Comment Found