将文件拖到桌面快捷方式 - 不在应用程序中打开文件 [英] Drag Files To Desktop Shortcut - Not Opening Files in Application

查看:23
本文介绍了将文件拖到桌面快捷方式 - 不在应用程序中打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小型日志查看器应用程序可以读取一些自定义日志.我可以直接把文件拖到可执行文件上,通过命令行加载就好了.

I've got a small log viewer app to read some custom logs. I can drag files directly onto the executable, and they are loaded through the command line just fine.

但是,如果我将文件拖到桌面快捷方式,Windows 将不会使用这些文件作为命令行参数打开应用程序.它根本不会打开应用程序.

However, if I were to drag the files to a desktop shortcut, Windows will not open the application using the files as the command line arguments. It won't open the application at all.

我有什么遗漏吗?

这是在 Windows 7 Enterprise x64 上运行的,没有以任何提升的权限运行.这都是用 C#、.NET 4.0 客户端框架等编写的.

This is on Windows 7 Enterprise x64, not running with any elevated privileges. This is all written in C#, .NET 4.0 Client framework, etc.

推荐答案

你的桌面快捷方式是广告快捷方式?您不能拖放到广告的快捷方式上.如果您正在使用 WiX 或 Visual Studio 安装项目为您的应用程序创建 .msi 安装程序,那么 Windows 安装程序为您创建的桌面快捷方式可能是宣传的快捷方式.此外,您可以通过右键单击快捷方式、查看属性并查看目标"字段是否显示为灰色来判断快捷方式是否已发布.如果是,那么它是广告.防止这种情况的一种方法是设置 DISABLEADVTSHORTCUTS 属性,这是一个 Windows Installer 属性.设置此属性将禁用您的应用程序的所有广告快捷方式.

Is your desktop shortcut an advertised shortcut? You cannot drag and drop onto an advertised shortcut. If you are using WiX or the Visual Studio Setup Projects to create a .msi installer for your application, then it's possible that your desktop shortcut which the Windows Installer is creating for you is an advertised shortcut. Also, you can tell whether or not a shortcut is advertised, by right-clicking it, viewing properties, and seeing whether or not the Target field is grayed out. If it is, then it is advertised. One way to prevent this is to set the DISABLEADVTSHORTCUTS property, which is a Windows Installer property. Setting this property will disable all advertised shortcuts for your application.

设置或测试它的最简单方法是使用 Orca,然后在属性表中添加一个名为 DISABLEADVTSHORTCUTS 且值为 1 的属性,然后再次尝试安装.

The simplest way to set or test this is to open the .msi file with Orca, and add a property named DISABLEADVTSHORTCUTS with a value of 1 to the Property table, then try installing it again.

这篇关于将文件拖到桌面快捷方式 - 不在应用程序中打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆