ActiveXObjects FileSystemObject生成网站

时间:2018-05-14 17:20:23

标签: javascript html activexobject

此页面有2个文本输入和1个按钮。当用户单击该按钮时,脚本应执行以下操作:

将“template”文件夹从当前目录复制到新目录中,该目录的路径由两个文本输入的值确定。 例如,如果用户输入“foo”和“bar”,程序会将“\ template”复制到新目录“\ foo \ bar”。

更新:新版本几乎可以使用,但我的文件路径有问题:

<html>
    <body>  

        Company DIR: <input id="companyDIR" "type="text" value="generic"><br>
        State URL: <input id="stateURL" type="text" value=""><br>

        <form name="myForm">
            <input type="Button" id="buildButton" value="Click to build the Link">

            <script>
                var myButton = document.getElementById("buildButton");
                myButton.addEventListener("click", function(){
                    var myObject = new ActiveXObject("Scripting.FileSystemObject");
                    myObject.CreateFolder ("C:\\Program Files\\linkbuild\\export\\" + companyDIR.value + "\\" + stateURL.value + "\\");
                    var myObject2;
                    myObject2 = new ActiveXObject("Scripting.FileSystemObject");
                    var destination_myObject2 = "C:\\Program Files\\linkbuild\\export\\" + companyDIR.value + "\\" + stateURL.value + "\\";
                    myObject2.CopyFolder("C:\\Program Files\\linkbuild\\template\\*", destination_myObject2);
                });
            </script>

        </form>

        <script>
            document.write("Create Directory: " + stateURL.value );
        </script>

    </body>
</html>

0 个答案:

没有答案