开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜