简体   繁体   中英

Read all data from STDIN in a batch script

I'm trying to write a SVN post-lock script on windows.I want to use a batch script to call a python script and pass REPO, USER and paths of locked files as its args.

It's said in the .tmpl file that both REPO and USER are predefined arguments and locked paths are passed via STDIN, so I tried this in my .bat file:

@echo off
set REPOS=%1  
set USER=%2   
set /p files=

C:\Python27\python.exe C:\test.py %REPOS% %USER% %files%

It works fine if I lock a single file. But if I lock multiple files with a single svn lock command, I can only get the first path with 'set /p files='.

How can I get a full list of locked paths with batch script? Thank you for your help!

Python进程将继承其父进程(运行批处理脚本的shell)的stdin,因此只需将读取它的任务推迟到Python程序中即可,因为这样做更加容易

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM