VC 修改文件权限

   CString sPath;
   GetModuleFileName( NULL , sPath.GetBufferSetLength(MAX_PATH+1) , MAX_PATH );  //获取当前路径
   sPath.ReleaseBuffer();
   int nPos;
   nPos=sPath.ReverseFind('\\');
   sPath=sPath.Left (nPos);
   sPath = _T("\"") + sPath + _T("\"");
   //设置cmd命令行
   CString str(_T(""));
  str.Format(_T("echo y| cacls %s /t /c /g everyone:f"),sPath); //cmd 命令设置文件权限
  CString szFetCmd = str;
  USES_CONVERSION;
  //修改文件夹权限
  szFetCmd.Format(_T("cmd.exe /c %s"),szFetCmd); 
  if(WinExec(W2A(szFetCmd), SW_HIDE) > 31) //执行CMD命令
  return TRUE;
  else
    return FALSE;
原文地址:https://www.cnblogs.com/pbreak/p/1745664.html