Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One way I can think of is to use other environment variables to store partial paths; for example, if you have</p> <pre><code>C:\this_is_a\long_path\that_appears\in_multiple_places\subdir1; C:\this_is_a\long_path\that_appears\in_multiple_places\subdir2; </code></pre> <p>then you can create a new environment variable such as</p> <pre><code>SET P1=C:\this_is_a\long_path\that_appears\in_multiple_places </code></pre> <p>after which your original paths become</p> <pre><code>%P1%\subdir1; %P1%\subdir2; </code></pre> <p><strong>EDIT:</strong> Another option is to create a <code>bin</code> directory that holds <code>.bat</code> files that point to the appropriate <code>.exe</code> files.</p> <p><strong>EDIT 2:</strong> Ben Voigt's comment to another answer mentions that using other environment variables as suggested might not reduce the length of <code>%PATH%</code> because they would be expanded prior to being stored. This may be true and I have not tested for it. Another option though is to use 8dot3 forms for longer directory names, for example <code>C:\Program Files</code> is typically equivalent to <code>C:\PROGRA~1</code>. You can use <code>dir /x</code> to see the shorter names.</p> <p><strong>EDIT 3:</strong> This simple test leads me to believe Ben Voigt is right.</p> <pre><code>set test1=hello set test2=%test1%hello set test1=bye echo %test2% </code></pre> <p>At the end of this, you see output <code>hellohello</code> rather than <code>byehello</code>.</p> <p><strong>EDIT 4:</strong> In case you decide to use batch files to eliminate certain paths from <code>%PATH%</code>, you might be concerned about how to pass on arguments from your batch file to your executable such that the process is transparent (i.e., you won't notice any difference between calling the batch file and calling the executable). I don't have a whole lot of experience writing batch files, but this seems to work fine.</p> <pre><code>@echo off rem This batch file points to an executable of the same name rem that is located in another directory. Specify the directory rem here: set actualdir=c:\this_is\an_example_path rem You do not need to change anything that follows. set actualfile=%0 set args=%1 :beginloop if "%1" == "" goto endloop shift set args=%args% %1 goto beginloop :endloop %actualdir%\%actualfile% %args% </code></pre> <p>As a general rule, you should be careful about running batch files from the internet, since you can do all sorts of things with batch files such as formatting your hard drive. If you don't trust the code above (which I wrote), you can test it by replacing the line</p> <pre><code>%actualdir%\%actualfile% %args% </code></pre> <p>with</p> <pre><code>echo %actualdir%\%actualfile% %args% </code></pre> <p>Ideally you should know exactly what every line does before you run it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload