Author Topic: Accessing a console application environment wide on WIndows  (Read 1851 times)

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1013
Accessing a console application environment wide on WIndows
« on: January 28, 2018, 06: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

Offline Goof

  • Jr. Member
  • **
  • Posts: 57
Re: Accessing a console application environment wide on WIndows
« Reply #1 on: January 28, 2018, 08: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.


Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1013
Re: Accessing a console application environment wide on WIndows
« Reply #2 on: January 28, 2018, 11:32:20 PM »
Thanks Goof,

I was adding new environment variables instead of editing path.

With your graphics, I figured it out!

-Brett

Offline Goof

  • Jr. Member
  • **
  • Posts: 57
Re: Accessing a console application environment wide on WIndows
« Reply #3 on: January 29, 2018, 03: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.