Home php cmd command in php

cmd command in php




I need to execute windows cmd command in my php script in a loop

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')
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.


https://stackoverflow.com/questions/7093860/php-shell-exec-vs -exec

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions