X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Run Wscript From Php    
post Jun 28 2018, 09:33 AM

Posts: 637
Joined: 3-June 11
From: Miami, FL

Hi Guys -

I'm running a php script as follow:
    $obj = NEW COM('WScript.Shell');
    if (is_object($obj)) {
        $cmd = 'wscript "C:\dir\subdir\move_file.vbs"';
        $obj->Run('cmd /C '.$cmd, 0, $wait);
    } else {
        echo 'can not create wshell object';
    $obj = null;

The vbs simply creates a copy of the a file in another location. Works perfectly when I hard code the file location and the destination folder.
But I can't make it work passing the source and destination as parameters

Bottom line, How to build my $cmd with the parameters?!

I tried the following but no luck
    $cmd = 'wscript ""C:\dir\subdir\move_file.vbs ';
        $cmd = $cmd."/From:".Chr(34).Chr(34)."$fFile".Chr(34).Chr(34)." ";
        $cmd = $cmd."/To:".Chr(34).Chr(34)."$tFile".Chr(34).Chr(34).Chr(34).Chr(34);

Thanks a lot for the help
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    5th August 2020 - 09:19 AM