Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Qt 使用windows批处理为目录中的所有.ui文件运行uic_Qt_Batch File_Windows 7 - Fatal编程技术网

Qt 使用windows批处理为目录中的所有.ui文件运行uic

Qt 使用windows批处理为目录中的所有.ui文件运行uic,qt,batch-file,windows-7,Qt,Batch File,Windows 7,我可以得到Qt.ui文件列表,如下所示: D:\programing\qtproject\ui\designer>dir *.ui /B main.ui mainmenu.ui mainwindow.ui 我现在要做的是手动为每一个应用程序运行uic,因为我正在使用的IDE(具有讽刺意味的是,QtCreator是一个应该与Qt完全兼容的IDE)不能做到这一点 因此,我可以使用从dir*.ui/B获取的文件列表运行uic?我希望它能在所有子目录上递归运行。好的,我用一些有用的答案破解了它:

我可以得到Qt
.ui
文件列表,如下所示:

D:\programing\qtproject\ui\designer>dir *.ui /B
main.ui
mainmenu.ui
mainwindow.ui
我现在要做的是手动为每一个应用程序运行
uic
,因为我正在使用的IDE(具有讽刺意味的是,QtCreator是一个应该与Qt完全兼容的IDE)不能做到这一点


因此,我可以使用从
dir*.ui/B
获取的文件列表运行
uic
?我希望它能在所有子目录上递归运行。

好的,我用一些有用的答案破解了它:

@echo off
rem Runs uic command over all files in all subdirectories
rem For loop arguments explained here: http://stackoverflow.com/a/3433012/607407
rem start command arguments explained here: http://stackoverflow.com/a/154090/607407
rem       /B is why the start creates no additional windows: http://stackoverflow.com/a/324549/607407

for /f %%F in ('dir *.ui /S /B') do start "" /B "uic" %%F -o %%~dpFui_%%~nF.h
要禁用递归(子目录),请删除
dir
命令中的
/S
参数