Skip to content

Instantly share code, notes, and snippets.

Last active December 14, 2015 13:29
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Use this to make files in IronPython\Scripts executable from the windows command prompt. Add IronPython and Scripts folders to PATH then run "update_scripts C:\Program Files\IronPython 2.7\Scripts".
@setlocal enabledelayedexpansion && ipy -x "%~f0" %*& exit /b !ERRORLEVEL!
import os
import sys
scripts_dir = sys.argv[1]
scripts = os.listdir(scripts_dir)
for script in scripts:
if script.endswith('.cmd'):
script_path = os.path.join(scripts_dir, script)
with open(script_path + '.cmd', 'w') as f:
f.write('@echo off\r\n')
f.write('"%s" "%s" %%*\r\n' % (sys.executable, script_path))
f.write('exit /b !ERRORLEVEL!\r\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment