我创建了一个批处理文件,将一些 dll 文件复制到 System32 文件夹中。我从用 C# 代码编写的程序中运行了这个批处理:
string path = @"ABC\install.bat";
ProcessStartInfo procStartInfo = new ProcessStartInfo()
{
UseShellExecute = true,
CreateNoWindow = false,
FileName = "\"" + path + "\"",
//Arguments = "\"" + path + "\""
Verb = "runas"
};
using (Process proc = new Process())
{
proc.StartInfo = procStartInfo;
proc.Start();
}
一切正常。我收到了确认从 Windows 7 更改的弹出消息。控制台也证明文件已被复制:
C:\Program Files\XXX>copy commpro.dll C:\Windows\system32\
1 file(s) copied.
但是当我查看 System32 文件夹时,我在那里找不到我的 dll。太奇怪了!
有人出现这个问题吗?
编辑:我的问题与这个问题不同:How to write files in C:\Windows\System32 with full permissions
在这里,我得到了允许我授予写入 System32 文件夹的权限的弹出窗口。并且“复制”命令的输出没有显示“拒绝访问”而是“复制”。问题是为什么它说“已复制”时不包含我的 dll?