Skip to content

Instantly share code, notes, and snippets.

@bancek
Created October 14, 2011 16:00
Show Gist options
  • Save bancek/1287498 to your computer and use it in GitHub Desktop.
Save bancek/1287498 to your computer and use it in GitHub Desktop.
Python replace exe files with bat files
import os
from glob import glob
for file in glob('*-script.py'):
exe = file.replace('-script.py', '.exe')
bat = file.replace('-script.py', '.bat')
ax = filter(os.path.exists, [exe, bat])
print file
map(os.remove, ax)
with open(bat, 'w') as f:
f.write('@python "%s" %%*' % os.path.abspath(file))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment