Skip to content

Instantly share code, notes, and snippets.

@sherbang
Last active December 14, 2015 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sherbang/5093976 to your computer and use it in GitHub Desktop.
Save sherbang/5093976 to your computer and use it in GitHub Desktop.
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'):
continue
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