我可以 运行 一个 Windows Powershell 命令匹配当前目录和所有子目录中的所有文件吗?

Can I run a Windows Powershell command matching all files in the current directory and all subdirectories?

我的文件结构如下所示:

maindir/
  - subdir/
      - file1.ts
      - file2.ts
  - file3.ts
  - file4.ts

我正在尝试使用 ts-interface-builder 构建打字稿界面,我想匹配并构建所有 4 个 file*.ts 文件。 (ts-interface-builder 只是构建类型,这个问题主要是关于 Windows Powershell 中的匹配模式/通配符,因为我习惯了 Unix)。

我目前正在使用这个命令:

npx ts-interface-builder ./maindir/*.ts

但这只会构建 file3.tsfile4.ts。 我可以使用稍微不同的命令:

npx ts-interface-builder ./maindir/*/*.ts

但它只构建 file1.tsfile2.ts

我尝试研究 Windows Powershell 通配符,但没能搞清楚。 有没有 single 命令可以用来构建所有 4 个文件?

假设您的 npx 命令由/从 PowerShell 执行:

npx ts-interface-builder (Get-ChildItem ./maindir -Recurse -Filter *.ts).FullName

另请参阅:Get-ChildItem cmdlet。