I want to compress a folder using NTFS compression in .NET. I found this post, but it does not work. It throws an exception (\"Invalid Parameter\").
DirectoryI
When creating the Win32_Directory.Name=... string you need to double the backslashes, so for example the path C:\Foo\Bar would be built up as:
Win32_Directory.Name="C:\\Foo\\Bar",
or using your example code:
string objPath = "Win32_Directory.Name=\"C:\\\\Foo\\\\Bar\"";
Apparently the string is fed to some process that expects an escaped form of the path string.