有没有办法使用ProcessStartInfo在Windows最近的项目跳转列表中创建一个快捷方式?



我正在使用 ProcessStart 和 ProcessInfoStart 从 %username%\My Documents 文件夹位置下的目录中打开一个 PDF 文件。如果我以编程方式打开文件,pdf 不会显示在 C:\Users\%username%\AppData\Roaming\Microsoft\Windows\最近项目位置下 - 但会显示在 Adobe Acrobat 的跳转列表中。如果我在文件资源管理器中双击该文件,PDF 将显示在"最近使用的项目"位置。

我尝试将PDF保存并打开为HTML文档,但它们仍然不会显示在"最近使用的项目"下。已尝试在启动 ProcessStartInformation 时直接调用 Acrobat。

var processStart = new ProcessStartInfo("AcroRd32.exe");

我尝试直接打开文件资源管理器并使用文件路径传入"/select" - 它将在 Acrobat 中打开,但不显示在"最近使用的项目"中。

var processStart = new ProcessStartInfo("AcroRd32.exe");
var savePath = @"C:Users%username%My DocumentsPDFsMyPdf.pdf";
//processStart.Arguments = savePath;
processStart.WindowStyle = ProcessWindowStyle.Minimized;
var fileArgs = $"/select, ""{savePath}""";
processStart.Arguments = fileArgs;
processStart.UseShellExecute = false;
Process.Start(processStart);

有没有办法在使用 ProcessStart 打开文件位置时刷新/更新"最近使用的项目"跳转列表?谢谢!

有一个选项可以通过SHAddToRecentDocs API手动添加它:

下面是 C# 示例:

public enum ShellAddToRecentDocsFlags
{
Pidl = 0x001,
Path = 0x002
}
[DllImport("shell32.dll", CharSet = CharSet.Ansi)]
private static extern void SHAddToRecentDocs(ShellAddToRecentDocsFlags flag, string path);

用法:

SHAddToRecentDocs(ShellAddToRecentDocsFlags.Path, @"C:Users%username%My DocumentsPDFsMyPdf.pdf");

最新更新