- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我必须做的最困难的事情之一是使用 PowerShell 访问 Windows API。我想使用 Shell32.dll 中的 API 清除回收站。还有其他方法可以做到这一点,但它们通常会绕过正常的 Windows 进程,在这种情况下,我想以“正确”的方式进行。
最佳答案
几个小时后,我想到了这个。
$TypeDefinition=@"
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
namespace shell32 {
//Put all the variables required for the DLLImports here
enum RecycleFlags : uint { SHERB_NOCONFIRMATION = 0x00000001, SHERB_NOPROGRESSUI = 0x00000002, SHERB_NOSOUND = 0x00000004 }
public static class RecycleBin {
[DllImport("Shell32.dll",CharSet=CharSet.Unicode)]
internal static extern uint SHEmptyRecycleBin(IntPtr hwnd, string pszRootPath, RecycleFlags dwFlags);
}
public class ShellWrapper : IDisposable {
// Creates a new wrapper for the local machine
public ShellWrapper() { }
// Disposes of this wrapper
public void Dispose() {
GC.SuppressFinalize(this);
}
//Put public function here
public uint Empty() {
uint ret = RecycleBin.SHEmptyRecycleBin(IntPtr.Zero, null, RecycleFlags.SHERB_NOCONFIRMATION | RecycleFlags.SHERB_NOPROGRESSUI | RecycleFlags.SHERB_NOSOUND);
return ret;
}
// Occurs on destruction of the Wrapper
~ShellWrapper() {
Dispose();
}
} //Wrapper class
}
"@
Add-Type -TypeDefinition $TypeDefinition -PassThru | out-null
$RecycleBin=new-object Shell32.ShellWrapper
$RecycleBin.Empty()
关于c# - 使用 Powershell 以编程方式清除回收站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22871595/
@ 目录 原理 创建过滤器 使用过滤器 查询 删除 恢复
我在回收站 View 中使用了一个 item.xml,但文本超出了屏幕。我试图依靠这个 answer , You can avoid all of this by giving each textvi
我的应用程序中有一个回收站 View 。每个回收器 View 项都有一个 imageView。我使用 asyncTask 加载位图并将它们添加到磁盘缓存,然后再将它们设置到 onPostExecute
我已经多次问过这个类似的问题,我花了 2 周多的时间才试图找出解决方案。是的,我知道有多个类似的问题,但我问的原因是因为堆栈上流的解决方案都不起作用。我是 Android 开发的初学者,因此我问你请帮
有谁知道允许特定角色的用户查看 Sitecore 回收站中所有项目的解决方案? 目前,只有管理员可以查看所有已删除的项目。用户只能看到他们已删除的项目。 最佳答案 没有开箱即用的方法,SqlArchi
您好,我有以下回收器适配器: package com.example.app.adapters; import android.annotation.TargetApi; import android
我看不到回收 View ,不确定哪里出了问题。如果你能帮助我,那就太好了。 fragment public class CallDurationFragment extends Fragment {
我是 android 开发的新手。我有一个带有 Viewholder 的 recyclerview 用于显示照片。我在我的应用程序中实现了 like 功能,但我面临的唯一问题是当我添加一个 喜欢 在照
我正在编写一个消息传递应用程序,在 RecyclerView 中显示我的消息和其他消息。 白色背景消息是我的消息,彩色消息是其他消息。 当每条消息顺序为“我的消息,其他消息,...”时,回收站 Vie
我创建了一个包含不同类型 subview 的社交帖子回收 View 。每个 child 多个 layout.recyclerview 工作正常,唯一的问题是 recyclerview 滚动不流畅。 我
我有一个像这样的 View 模型 - private val viewState = SchoolsViewState() fun onViewOpened() = Trans
我正在研究 Android 的应用程序接近完成它但我在 recyclerView 中发现了问题,我不知道如何在 recyclerView 的 Item 的 TextView 上实现点击监听器? (当我
我正在做一个 RecyclerView 示例。问题是,当我在列表中添加第一个项目时,它会在回收 View 中正确显示该项目,但我添加的下一个项目不会显示在回收 View 中。 请帮帮我。 适配器代码是
我想问一下我如何从适配器回收器 View 调用 Activity 中的方法。 在函数 buildRecyclerView 中设置适配器: private void buildRecyclerView(
这个问题在这里已经有了答案: Custom Adapter getView() method is not called (6 个答案) 关闭 6 年前。 我正在使用回收站 View ,但它没有显示
我有一个回收站 View ,我在其中显示了自定义行,但该行未填满宽度。我已经添加了 match_parent 宽度,但它仍然只是包装内容。 我的回收站 View -:
我一直在使用回收器 View 在我的 fragment 上显示 15 张图像。图像位于可绘制文件夹中。我尝试了外部 View 来执行此操作,但速度要慢得多并且滞后很多。因此我使用回收者 View 来解
我的问题是我希望回收站 View 响应对整个 View 的点击,而不是对回收站 View 具有的每个项目的单独点击 viewModel.handleClick()}"
以下是我的行项目的布局:
我正在处理 Recycler View ,在这里我将三个回收器 View 水平放置在布局中。问题是第二个和第三个回收器 View 项目显示但无法滚动,即使在内部使用嵌套滚动并特此附加xml。请建议我如
我是一名优秀的程序员,十分优秀!