Affecting environment through a BAT file

You have encountered a problem using Far Manager? Here you can get help.
Post Reply
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Affecting environment through a BAT file

Post by pepak »

I faintly recall that some years ago there was a post about modifying FAR's environment through a BAT file. Is there anyone who can remember and/or find it?

The core of the problem is this: I am running FAR. In it, I can influence its environment with the SET command:

Code: Select all

SET path=%path%;x:\y\z
But I can't do that with a BAT file, at least not directly - the BAT file would only affect its own environment which disappears as soon as the BAT file quits. I think the post I am looking for involved some trick or maybe a special execution call which carried changes to the BAT's environment over to the calling FAR. But I can't really remember :-(

The only solution I know of involves running a BAT file which, as its last command, would execute a new instance of FAR. That instance would inherit the BAT's environment, including the changes. Unfortunately it means an unnecessary extra instance, but I can live with it if there is no other way.
User avatar
HaRT
Moderator
Posts: 10869
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 221 times
Been thanked: 358 times

Re: Affecting environment through a BAT file

Post by HaRT »

SetEnv: announcement, discussion (both in Russian).
The download link is stale though so don't forget to find a valid one and post it there.
Фар есть инструмент, а не нянька. © 2009 DrKnS
Maximus5
Posts: 3295
Joined: Sun 11 Nov, 2007 02:03
Been thanked: 10 times
Contact:

Re: Affecting environment through a BAT file

Post by Maximus5 »

Another way - using FarCall plugin via command line prefix
this plugin allows to call external batch files & import environment variables to Far process

how to use:

1. type call:batch_file_name
or
2. set cursor on batch file, press F11 & select "Far Call" plugin
tomyam
Posts: 19
Joined: Mon 19 Jan, 2009 03:06
Has thanked: 4 times

Re: Affecting environment through a BAT file

Post by tomyam »

Post Reply

Return to “Support and Troubleshooting”