I need to execute windows cmd command in my php script in a loop
icacls
In terminal, I execute icacls \\ FS \ folder \ file.txt / inheritance: e
The command enables inheritance on the specified file.
How do I execute this command correctly?
Tried system ('icacls \\ FS \ folder \ file.txt / inheritance: e')
or
exec ('icacls \\ FS \ folder \ file.txt / inheritance: e');
But I don’t get any errors or results, tell me how to do it right?
Answer 1, authority 100%
After a day of proceedings, I found a solution:
In environment variables, I overwritten the PATH variable to% USERPROFILE% \ AppData \ Local \ Temp, restarted Apache and it worked.
Answer 2
There is a second parameter where you need to pass the variable by reference. the result of the execution will be there.
http://php.net/manual/en/function.exec.php
https://stackoverflow.com/questions/7093860/php-shell-exec-vs -exec