【问题标题】:How to delete a file using Windows Sidebar Gadget API?如何使用 Windows 边栏小工具 API 删除文件?
【发布时间】:2010-08-31 13:14:36
【问题描述】:

我知道 Windows 边栏小工具 API 提供的功能超出了正常的 Javascript 功能。它会操纵文件吗?怎么样?

我在API Reference没有找到怎么做

【问题讨论】:

    标签: javascript windows-desktop-gadgets


    【解决方案1】:

    使用System.Shell.RecycleBin.deleteItem 方法。

    retVal = System.Shell.RecycleBin.deleteItem(
      strItemToDelete
    )
    

    【讨论】:

      【解决方案2】:

      我不知道使用 Gadget API 删除文件的方法,但您可以使用 FileSystemObjectDeleteFile 方法:

      var oFSO = new ActiveXObject("Scripting.FileSystemObject");
      oFSO.DeleteFile(System.Gadget.path+"\\myfile.txt");
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2010-12-24
        • 1970-01-01
        • 2015-09-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多