Running Dos Path Command

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Running Dos Path Command

Post by kpassaur » Sat Dec 05, 2009 7:30 pm

I want to modify the path statement and in DOS this will do the trick

Path = %PATH%;C:\Program Files\Print PDF

In MS I have tried it like this:

RunProgram>cmd /c Path = %PATH%;C:\Program Files\Print PDF

and a few different ways with VAREXPLICIT set to 1 and to 0 with no sucess. Any ideas?

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Running Path from MS

Post by kpassaur » Sat Dec 05, 2009 9:28 pm

Bob,

Yes, I tried it without spaces
I am running it on XP and then later will test on Vista
I am using MS Pro 11.1.06 From March of 2009
There are no trailing spaces.
After I run it I open the command prompt window and type in Path to see what it is and it has never changed.

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Sat Dec 05, 2009 11:34 pm

When you set the path or any other environment variable in a DOS window, the value is only valid within that window. To set teh path you need to change it in the registry. I'm using XP. This works for me.

Code: Select all

RegistryReadKey>HKEY_LOCAL_MACHINE,SYSTEM\ControlSet001\Control\Session Manager\Environment,Path,result

Let>result=%result%;C:\Program Files\Print PDF

RegistryWriteKey>HKEY_LOCAL_MACHINE,SYSTEM\ControlSet001\Control\Session Manager\Environment,Path,result

RegistryReadKey>HKEY_LOCAL_MACHINE,SYSTEM\ControlSet001\Control\Session Manager\Environment,Path,result2
mdl>result2

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

update path statement

Post by kpassaur » Sun Dec 06, 2009 9:42 am

JRL

It looked like your solution would work but it didn't for some unkown reason.

I ran it, checked the registry and it was changed. So that part works fine. I went to a command prompt and typed path and it was the same as before. So I figured that I needed to reboot, which I did. Same result, it was not in the path statement after the reboot.

I then went into the registry and checked and the line was updated. So, I don't know what else to try.

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Set Path

Post by kpassaur » Sun Dec 06, 2009 12:53 pm

Well more investigation found that although it did not appear on the line when path was entered it is somehow there.

Before if I entered the path and ran the application it would run. If I didn't change the path statement I would get an error. With the above change it runs even though it does not appear in the path when I type path at the command prompt. Thank you

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts