Linux like script level exec command on windows xampp
Posted: 13. September 2018 11:25
How to execute windows command in a PHP script in a similar way we do on linux?
For example, to copy file from one directory to another we can execute the linux find & cp command directly into a PHP script like,
On the other hand to copy file through windows command prompt we use,
but the above command isn't working in script level execution when it is executed as,
How to execute windows command in php script level in this case?
exec is enabled on my xampp.
Thanks,
For example, to copy file from one directory to another we can execute the linux find & cp command directly into a PHP script like,
- Code: Select all
<?php
exec("find E:/xampp/htdocs/site.com/image/ -name test.png -exec cp {} E:/xampp/htdocs/site.com/thumb/\;");
?>
On the other hand to copy file through windows command prompt we use,
- Code: Select all
E:\xampp\htdocs\site.com\image> copy test.png E:\xampp\htdocs\site.com\thumb
but the above command isn't working in script level execution when it is executed as,
- Code: Select all
<?php
exec("E:\xampp\htdocs\site.com\image> copy test.png E:\xampp\htdocs\site.com\thumb");
?>
How to execute windows command in php script level in this case?
exec is enabled on my xampp.
Thanks,