I'm trying to use this code to grant the current user full permissions to access System Volume Information:

//It works when manually written in cmd
cacls "E:\System Volume Information" /t /e /g %username%:F



    //but using this formula to make the command window hidden does not work(doesn't give the permission or hide the window)
Process^ P  = gcnew Process;
P->StartInfo->FileName = "cacls.exe";
P->StartInfo->Arguments = "cacls \"E:\\System Volume Information\" /t /e /g %username%:F";
P->StartInfo->WindowStyle = ProcessWindowStyle::Hidden ;
P->Start();

The code compiles but doesn't work.

Could anyone please give the right code please?

Recommended Answers

All 2 Replies

cacls is depreciated. Use icacls and see if that works for you.

Sorry for the late answer. I used icacls but it gives me the same cmd error:

It says that the path(E:\System Volume Information) is an invalid parameter.

Is there anything else I can do?

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.