Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Command (.cmd) file help  (Read 3952 times)

0 Members and 1 Guest are viewing this topic.

Paul Townsend

  • Guest
Command (.cmd) file help
« on: October 27, 2004, 07:55:09 PM »
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?

MalikTous

  • Guest
Re: Command (.cmd) file help
« Reply #1 on: November 03, 2004, 12:40:14 AM »
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 command

Paul Townsend

  • Guest
Re: Command (.cmd) file help
« Reply #2 on: November 03, 2004, 04:45:53 PM »
Thanks 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?

Paul Townsend

  • Guest
Re: Command (.cmd) file help
« Reply #3 on: November 03, 2004, 06:32:25 PM »
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...