【问题标题】:Run uic for all .ui files in directory using windows batch使用 Windows 批处理为目录中的所有 .ui 文件运行 uic
【发布时间】:2015-12-14 11:40:19
【问题描述】:

我可以得到一个 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 batch-file windows-7


    【解决方案1】:

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

    @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 参数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-07-27
      • 2011-08-07
      • 1970-01-01
      • 2012-03-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多