1234567891011121314151617181920 |
- from concurrent.futures import ThreadPoolExecutor
- from pathlib import Path
- import subprocess
- import sys
- def task(name):
- print(Path(name).name)
- return subprocess.Popen(f'C:\\Windows\\System32\\cmd.exe /C "{name}"', stdout=subprocess.DEVNULL).wait()
- def main(base_dir):
- files = [str(f) for f in Path(base_dir).glob('*.bat') if not f.name.startswith('_')]
- with ThreadPoolExecutor(max_workers=5) as executor:
- executor.map(task, files)
- if __name__ == '__main__':
- main(f"C:\\GlobalCube\\System\\{sys.argv[1]}\\SQL\\batch")
|