Outpost Universe Forums

Off Topic => Computers & Programming General => Topic started by: Vagabond on January 28, 2018, 05:52:09 PM

Title: Accessing a console application environment wide on WIndows
Post by: Vagabond on January 28, 2018, 05:52:09 PM
Hey everyone,

I've been happy working more in the command prompt (console) on Windows for certain tasks. In particular, I've been using OP2Archive a fair amount and playing with Git Bash.

Git Bash is nice because I can call git from any directory on my machine and it will be recognized.

For OP2Archive, I have to paste the executable (and 2 template files) into whatever directory I want to work in. Is there a way to register the program with the console so it can be called from any directory?

I think maybe this is supposed to be done with environment variables, but I had trouble understanding the concept/getting it to work.

Just looking for some insights if anyone has some.

Thanks,
Brett
Title: Re: Accessing a console application environment wide on WIndows
Post by: Goof on January 28, 2018, 07:53:30 PM
On windows standard console, just use
Code: [Select]
SET PATH=%PATH%;c:\Directory\sub\gitdir

then a call to
Code: [Select]
echo %PATH%
should display the modifications added to the variable.

You also could add the path to your user/system default PATH environment variable.
In the System properties dialog box there is a way for that.

(http://forum.outpost2.net/index.php?action=dlattach;topic=6066.0;attach=1175;image)
Title: Re: Accessing a console application environment wide on WIndows
Post by: Vagabond on January 28, 2018, 10:32:20 PM
Thanks Goof,

I was adding new environment variables instead of editing path.

With your graphics, I figured it out!

-Brett
Title: Re: Accessing a console application environment wide on WIndows
Post by: Goof on January 29, 2018, 02:13:32 PM
you also can do a cmd file with

Code: [Select]
@echo off
cd C:\Temp
SET PATH=%PATH%;c:\Directory\sub\gitdir
SET PATH=%PATH%;c:\Directory\sub\whateverdir
cmd.exe

When you launch it the cmd.exe at the end inherit the updated Path above (or any other environment variables needed)

Code: [Select]
@echo off
Just avoid the lines below to be displayed.