|
Answer» Looking for a way to pull a directory out of the PATH environmental VARIABLE. Guess I'm more so looking for the drive letter. I know my path will CONTAIN \vision\bin ... I was thinking I could do a FOR loop but I'm just not getting it at midnight. Help is appreciated.
Code: [Select]for /F "tokens=1-26 delims=;" %%a in ('echo %PATH% ^ FIND /I "\vision\bin"') do set direct=%%a I figured I would use delims=; to separate each path out, but then again maybe that is my problem that when I set direct %%a isn't my path? I'm not sure.
Nevermind ... I got something to work.
Code: [Select]ECHO off setlocal enabledelayedexpansion for %%G in ("%PATH:;=" "%") do ( echo %%G | find /I "\vision\bin" >nul if !errorlevel! EQU 0 set direct=%%G ) setlocal disabledelayedexpansion if "%direct%"=="" ECHO direct equals nothing & pause set direct=%direct:"=% set direct=%direct:~0,9% echo "%direct%" Pause
|