c# - 执行批处理文件存在重复文件名,或找不到文件
问题描述
通过C#执行一个复杂的批处理文件,设置会话变量示例
SET TEST = rainbow
成名
A duplicate file name exists, or the file cannot be found.
我用了
string args = string.Format("/k \"cd /d {0} && {1}\"", s.Path, s.Filename + " " + userChoice);
RunBatch("cmd.exe", args, s.Path);
.
.
ProcessStartInfo startInfo = new ProcessStartInfo()
{
UseShellExecute = false,
WorkingDirectory = workingDir,
FileName = cmd,
Arguments = cmdArgs
};
Process.Start(startInfo);
在简单的批处理文件上尝试时。随着复杂的出现上面提到的错误。
--
我还尝试用 C#编写,这是一个新的批处理文件,第一行有
setlocal enableextensions disabledelayedexpansion
,然后调用需要的,并通过C#执行这个批处理,错误又是一样的......
任何提示?
解决方案
推荐阅读
- python - std::endl,在 Python 中是否有等价物?(返回+冲洗)
- c# - 为什么 IDE(Rider 和 Visual Studio)不根据官方文档增加 '*' 字符的程序集版本?我该如何解决?
- powerbi - 如何检查 PowerBi 服务中所有数据集的数据集刷新历史记录
- c# - 在索引上选择 ListboxItem(突出显示我会点击它)
- c# - 我们是否在 Azure 时间触发功能和活动功能中的重试选项中遇到并发问题?
- session - 模拟 getSession() 条件查询
- powershell - 如果找不到用户,如何让 Get-ADUser 显示错误?
- python - 无法在 PyCharm 中使用 Python 3.8 版本的解释器
- java - 如何指示我的程序在 Java 中显示一次错误消息
- opencl - 我应该如何查看全局和本地工作规模