Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.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
Powershell Pandoc批处理当前目录_Powershell_Docx_Pandoc - Fatal编程技术网

Powershell Pandoc批处理当前目录

Powershell Pandoc批处理当前目录,powershell,docx,pandoc,Powershell,Docx,Pandoc,我搜遍了无数这样的线索,似乎都没有用。目前,我正在尝试运行 for (/r "." %i in (*.docx) do pandoc -o "%~i.md" "%~i") 将当前目录中的所有.docx转换为.md。不幸的是,从Powershell ISE运行此命令时,我遇到以下消息 Missing statement body in for loop. + CategoryInfo : ParserError: (:) [], ParentContainsErrorR

我搜遍了无数这样的线索,似乎都没有用。目前,我正在尝试运行

for (/r "." %i in (*.docx) do pandoc -o "%~i.md" "%~i")
将当前目录中的所有.docx转换为.md。不幸的是,从Powershell ISE运行此命令时,我遇到以下消息

Missing statement body in for loop.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingLoopStatement
请提供有关如何使用powershell将满是.docx文件的目录转换为.md的建议。我有大约250个文件,我想转换,在绝望的援助需要

如前所述,您的命令使用的是无效的cmd.exe语法,而不是PowerShell语法

PowerShell翻译为:

Get-ChildItem -Recurse -Filter *.docx | ForEach-Object {
  pandoc -o ($_.FullName + '.md') $_.FullName
}

这不是powershell命令,这是Windows CMD命令谢谢您的澄清。我不熟悉windows批处理或PowerShell脚本,无法发现明显的区别:-