开发者

I get an "Invalid Name" error when I try to use "CopyEx"

开发者 https://www.devze.com 2023-01-13 21:15 出处:网络
Re开发者_如何转开发garding my previous problem that is now fixed, I got another problem with the //code here part :/

Re开发者_如何转开发garding my previous problem that is now fixed, I got another problem with the //code here part :/

foreach (ManagementObject obj in ObjSearcher.Get())
{  
    ManagementBaseObject inputArgs = obj.GetMethodParameters("CopyEx");
    inputArgs["FileName"] = "\\c:\\1stuff";
    inputArgs["Recursive"] = true;
    ManagementBaseObject outParams = obj.InvokeMethod("CopyEx", inputArgs, null);
    uint ret = (uint)(outParams.Properties["ReturnValue"].Value);
}

I keep getting a returnvalue of 9, which is "Invalid Name". I have no idea what got an invalid name nor how to fix it. Both folder exist.


You have a leading backslash in your file name. Try removing it. I'm not aware of any file paths that have the format you're using.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号