如何使用 C# 在 Pandoc 中更改目录?
How changing directories in Pandoc using C#?
如何使用 C# 在 Pandoc 中设置目录 并执行文件转换。
string processName = "pandoc.exe";
string arguments = @"cd C/Users/a/Desktop/ConvertFileApp/ConvertFileApp/bin/Debug/marcdovd "
+ "chapter1.markdown "
+ "chapter2.markdown "
+ "chapter3.markdown "
+ "title.txt "
+ "-o progit.epub";
var psi = new ProcessStartInfo
{
FileName = processName,
Arguments = arguments,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardInput = true
};
var process = new Process { StartInfo = psi };
process.Start();
此代码无效。
您正在使用 cd
命令作为 参数 调用可执行文件。这相当于 运行 命令行中的以下内容:
pandoc.exe cd C/Users/a/Desktop/ConvertFileApp/ConvertFileApp/bin/Debug/marcdovd chapter1.markdown chapter2.markdown chapter3.markdown title.txt -o progit.epub
虽然我不熟悉 Pandoc,但我想你真的想做这样的事情:
cd C:/Users/a/Desktop/ConvertFileApp/ConvertFileApp/bin/Debug/marcdovd
pandoc.exe chapter1.markdown chapter2.markdown chapter3.markdown title.txt -o progit.epub
为此,请从参数中删除 cd
命令并像这样设置 the ProcessStartInfo.WorkingDirectory
property:
string processName = "pandoc.exe";
string arguments = "chapter1.markdown "
+ "chapter2.markdown "
+ "chapter3.markdown "
+ "title.txt "
+ "-o progit.epub";
var psi = new ProcessStartInfo
{
FileName = processName,
Arguments = arguments,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardInput = true,
WorkingDirectory = @"C:/Users/a/Desktop/ConvertFileApp/ConvertFileApp/bin/Debug/marcdovd"
};
var process = new Process { StartInfo = psi };
process.Start();
如何使用 C# 在 Pandoc 中设置目录 并执行文件转换。
string processName = "pandoc.exe";
string arguments = @"cd C/Users/a/Desktop/ConvertFileApp/ConvertFileApp/bin/Debug/marcdovd "
+ "chapter1.markdown "
+ "chapter2.markdown "
+ "chapter3.markdown "
+ "title.txt "
+ "-o progit.epub";
var psi = new ProcessStartInfo
{
FileName = processName,
Arguments = arguments,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardInput = true
};
var process = new Process { StartInfo = psi };
process.Start();
此代码无效。
您正在使用 cd
命令作为 参数 调用可执行文件。这相当于 运行 命令行中的以下内容:
pandoc.exe cd C/Users/a/Desktop/ConvertFileApp/ConvertFileApp/bin/Debug/marcdovd chapter1.markdown chapter2.markdown chapter3.markdown title.txt -o progit.epub
虽然我不熟悉 Pandoc,但我想你真的想做这样的事情:
cd C:/Users/a/Desktop/ConvertFileApp/ConvertFileApp/bin/Debug/marcdovd
pandoc.exe chapter1.markdown chapter2.markdown chapter3.markdown title.txt -o progit.epub
为此,请从参数中删除 cd
命令并像这样设置 the ProcessStartInfo.WorkingDirectory
property:
string processName = "pandoc.exe";
string arguments = "chapter1.markdown "
+ "chapter2.markdown "
+ "chapter3.markdown "
+ "title.txt "
+ "-o progit.epub";
var psi = new ProcessStartInfo
{
FileName = processName,
Arguments = arguments,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardInput = true,
WorkingDirectory = @"C:/Users/a/Desktop/ConvertFileApp/ConvertFileApp/bin/Debug/marcdovd"
};
var process = new Process { StartInfo = psi };
process.Start();