Nmap Development mailing list archives

Re: Ndiff included in Windows zip distribution


From: "DePriest, Jason R." <jrdepriest () gmail com>
Date: Wed, 4 Feb 2009 18:39:14 -0600

would using

"%COMSPEC%" /c "%PYTHON%" "%PROG%" %*

maintain the exit state?

I don't have a Windows system up at the moment or I would try it.

-Jason

On Wed, Feb 4, 2009 at 5:17 PM, Fyodor <> wrote:
On Wed, Feb 04, 2009 at 04:09:00PM -0700, David Fifield wrote:

I probably doubled my knowledge of batch programming in writing this
little script, so I bet it could be done better. I attached it so anyone
more knowledgeable can comment on it. For a reference of the %~ variable
references, type "help for" at the Windows command prompt.

I think the mailing list anti-malware filter may block bat files, so
your attachment didn't go through.  But here it is inline (it is also
available in SVN at /nmap/mswin32/python-wrap.bat):

@echo off

rem This batch file searches for a Python interpreted and uses it to run a
rem script. It displays an error message if not Python is found. The script
rem to run must have the same filename as the batch file, with an extension of
rem .py rather than .bat.

setlocal

rem %0 is the name of the batch file. "dpn" means drive, path, filename
rem (excluding extension).
set PROG=%~dpn0.py

if not exist "%PROG%" (
       echo Cannot run %PROG%
       echo because that file does not exist.
       exit /B 1
)

set PATH=%PATH%;C:\Python26;C:\Python25;C:\Python24
for %%P in ( python.exe ) do set PYTHON=%%~f$PATH:P

if not exist "%PYTHON%" (
       echo Cannot run %PROG%
       echo because python.exe was not found anywhere in
       echo %PATH%.
       echo.
       echo To run this program, download and install Python from
       echo http://www.python.org/download.
       exit /B 1
)

"%PYTHON%" "%PROG%" %*

endlocal

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: