【问题标题】:The command line for 'atprogram' does not work properly in WPF“atprogram”的命令行在 WPF 中无法正常工作
【发布时间】:2019-11-29 07:10:03
【问题描述】:

我正在构建一个可以闪存 Atmel MCU 的 WPF 应用程序。我正在使用“atprogram”命令行来刷新 MCU。下面是代码sn-ps。

using (Process sortProcess = new Process())
{
    sortProcess.StartInfo.FileName = "cmd.exe";
    string path = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\Atmel\Studio\7.0\atbackend\atprogram";
    string hexFileName = "PROGRAM.hex";
    string arguments = FormattableString.Invariant($"/K \"{path}\" -t atmelice -i ISP -d atmega328pb program -f \"{hexFileName}\" --verify");
    sortProcess.StartInfo.Arguments = arguments;
    sortProcess.Start();
}

当我运行应用程序时,命令行显示:

'C:\Program' is not recognized as an internal or external command,
operable program or batch files.

当我从程序中删除 '\"{hexFileName}\"' 时 AND 还尝试在命令提示符上复制和粘贴参数(带双引号),该程序工作正常(即使它给出错误)。我可以知道是什么问题吗?

【问题讨论】:

  • 试图修改代码@"\Atmel\Studio\7.0\atbackend\atprogram.exe" 。祝你好运
  • 您好,我已尝试使用 .exe。但是,我仍然收到同样的信息。

标签: wpf atmel


【解决方案1】:

尝试执行此代码

        using (Process sortProcess = new Process())
        {
            sortProcess.StartInfo.FileName = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\Atmel\Studio\7.0\atbackend\atprogram.exe";
            string hexFileName = "PROGRAM.hex";
            string arguments = FormattableString.Invariant($" -t atmelice -i ISP -d atmega328pb program -f \"{hexFileName}\" --verify");
            sortProcess.StartInfo.Arguments = arguments;
            sortProcess.Start();
        }

【讨论】:

  • 嗨@Byoung Sam Moon,抱歉回复晚了。我的程序正在运行。非常感谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-01-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多