Skip to content

Windows XP: Batch of Goodies

A couple of Windows batch files.
Because sometimes while I’m at a Windows Console, I’m still thinking UNIX commands.

Launching a graphical executable from the command line

vi.bat


@echo off
start "title" /b "C:\Program Files\Vim\vim70\gvim.exe" %*

Locating the executable in the classpath

which.bat


@ECHO OFF
setlocal
set DELAY=YES
set DELAY=!DELAY!

if "%DELAY%" == "YES" (
set files=
for %%i in (%PATHEXT%) DO set files=!files!;%1%%i
for %%i in (!files!) DO if EXIST %%~$PATH:i (@echo.%%~$PATH:i)
) else (
if "%2" == "with_delay" (
echo Invalid state. Prevent infinite recursion
) else (
cmd /v:on /c which.bat %1 with_delay
)
)
endlocal

Links
Batch Reference
Command Line Reference

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

One Comment

  1. eceppda wrote:

    which.bat is slick! Thanks for sharing!

    Thursday, March 22, 2007 at 8:42 pm | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*