运行shell:windows命令,及显示桌面.scf的问题
2013-01-23 16:11
549 查看
“显示桌面.scf”内容是:
[Shell]
Command=2
IconFile=explorer.exe,3
[Taskbar]
Command=ToggleDesktop
(把上面文字粘贴到记事本里,保存为“显示桌面.scf”即可)
开始-运行-shell:******可以访问到系统的许多资源,具体如下:
我的电脑 shell:DriveFolder
我的文档 shell:Personal
我的图片 shell:My Pictures
我的视频 shell:My Video
我的音乐 shell:My Music
网上邻居 shell:NetworkFolder
桌面 shell:Desktop
桌面 shell:DesktopFolder
收藏夹 shell:Favorites
“发送到” shell:SendTo
“最近的文档” shell:Recent
开始菜单 shell:Start Menu
开始菜单-程序 shell:Programs
开始菜单-启动 shell:Startup
回收站 shell:RecycleBinFolder
控制面板 shell:ControlPanelFolder
网络连接 shell:ConnectionsFolder
字体 shell:Fonts
打印机 shell:PrintersFolder
管理工具 shell:Administrative Tools
Windows文件夹 shell:Windows
系统文件夹 shell:System
System32文件夹 shell:SystemX86
WEB文件夹 shell:InternetFolder
用户数据文件夹 shell:Profile
程序 shell:ProgramFiles
程序公用文件 shell:CommonProgramFiles
模板 shell:Templates
打印 shell:PrintHood
网络 shell:NetHood
历史 shell:History
Cookies shell:Cookies
本地程序数据 shell:Local AppData
程序数据 shell:AppData
共享文档 shell:Common document.
公用管理工具 shell:Common Administrative Tools
公用模板目录 shell:Common Templates
公用程序数据 shell:Common AppData
公用收藏夹 shell:Common Favorites
公用桌面 shell:Common Desktop
公用菜单 shell:Common Start Menu
公用程序菜单 shell:Common Programs
公用启动菜单 shell:Common Startup
关于"显示桌面" 及 C++ C# 实现代码
计算机左下角快速启动栏(地址:C:\Documents and Settings\luosiyong\Application Data\Microsoft\Internet Explorer\Quick Launch,其中红色的字体为你的计算机用户。如果你计算机中左下角快速启动栏中的“显示桌面”图标丢失了,可以直接在上述地址新建一个文本文件,写入如下代码,然后另存为"显示桌面.scf",注意扩展名;或者将在任意位置建立好的文件按住Ctrl并用鼠标左键拉到快速启动栏然后松手)中有一个图标叫“显示桌面”,平时比较爱用这个东西,对应的快捷键是win+D。在今天之前我认为它是很神秘的一个东西,因为今天之前我不知道它执行的原理,试着用记事本打开它,就发现了里面的秘密(记事本打开它的方法是,先打开记事本,然后把显示桌面的图标用鼠标拉到记事本中,松手),里面的代码如下:[Shell]
Command=2
IconFile=explorer.exe,3
[Taskbar]
Command=ToggleDesktop
然后我还尝试直接保存这段代码,但是不知道扩展名,因为尝试了很多知道的扩展名都没有达到期望的效果。于是网上搜索,结果它是
scf 扩展名(点击链接查看百度百科),同时代码的含义也基本看明白了……
百科的内容如下:
SCF文件是“WINDOWS资源管理器命令”文件,它也是一种可执行文件.
该类型文件由Windows Explorer Command解释,标准安装,包括下面3个该类型的文件
===========================
1) Explorer.scf(资源管理器)
[Shell]
Command=2
IconFile=explorer.exe,1
[Taskbar]
Command=Explorer
===========================
2)Show Desktop.scf(显示桌面)
格式类似如下:
[Shell]
Command=2
IconFile=explorer.exe,3
[Taskbar]
Command=ToggleDesktop
===========================
3)View Channels.scf(查看频道)
[Shell]
Command=3
IconFile=shdocvw.dll,-118
explorer.exe中的图标如下:(序号从0开始)
C++实现显示桌面:
/*
程序: 显示桌面 C++ 实现
说明: IShellDispatch4 接口只有WINDOWS XP以上的操作系统才支持,需要 shell32.dll 5.0或以上版本
编译环境: Microsoft Visual Studio 2008
*/
#include <windows.h>
#include <shldisp.h>
int main()
{
CoInitialize(0);
IShellDispatch4 * pdisp=NULL;
CoCreateInstance(CLSID_Shell,NULL,CLSCTX_ALL,__uuidof(IShellDispatch4),(void **)&pdisp);
pdisp->ToggleDesktop();
pdisp->Release();
CoUninitialize();
return 0;
}
C#实现显示桌面:
/*
* 程序 : 显示桌面 C# 实现
* 编译环境 : Microsoft Visual Studio 2008
*/
using System;
using System.Reflection;
namespace CSCONSOLE
{
class Program
{
public static void Main(string [] args)
{
Type oleType=Type.GetTypeFromProgID("Shell.Application");
object oleObject=System.Activator.CreateInstance(oleType);
oleType.InvokeMember("ToggleDesktop",BindingFlags.InvokeMethod,null,oleObject,null);
}
}
}
另外查询MSDN对于ToggleDesktop的解释:
ToggleDesktop Method (IShellDispatch4)ToggleDesktop Method
Displays or hides the desktop.
Syntax
IShellDispatch4.ToggleDesktop()
Return Value
No return value.
Remarks
This method has the same effect as the Show Desktop button in the Quick Launch area of the Taskbar. It either hides all open windows and shows the desktop, or it hides the desktop and shows all open windows. The
ToggleDesktop method does not display any user interface, it just invokes the toggle action.
Examples
The following example shows the proper usage of ToggleDesktop for Microsoft JScript, Microsoft Visual Basic Scripting Edition (VBScript), and Visual Basic.
JScript:
<script language="JScript"> function fnIShellDispatch4ToggleDesktopJ() { var objShell = new ActiveXObject("Shell.Application"); objShell.ToggleDesktop(); }</script>
VBScript:
<script language="VBScript"> function fnIShellDispatch4ToggleDesktopVB() dim objShell set objShell = CreateObject("Shell.Application") objShell.ToggleDesktop set objShell = nothing end function </script>
Visual Basic:
Private Sub fnIShellDispatch4ToggleDesktopVB() Dim objShell As Shell Set objShell = New Shell objShell.ToggleDesktop Set objShell = NothingEnd Sub
相关文章推荐
- 运行shell:windows命令,及显示桌面.scf的问题
- Ghostscript 中 ps2pdf 命令在 windows msys 下的运行错误问题。
- node中"require"不是内部或外部命令,也不是可运行的程序 或批处理文件;express -V无法显示express版本信息等问题。
- Windows下通过Cygwin运行shell命令
- windows 显示桌面.scf
- windows下编写shell脚本运行出错问题
- Windows下使用wxPython的pycrust交互shell方法。运行pywrap命令
- shell初级编程问题(一):fi关键字显示红色,运行报语法错误
- 【解决问题】windows下配置Boost提示'cl' 不是内部或外部命令,也不是可运行的程序 或批处理文件
- shell练习:写一个脚本实现如下功能:输入一个数字,然后运行对应的一个命令。显示命令如下:*cmd
- 02-dos2unix命令与windows编辑shell不可执行问题
- Ubuntu 下运行 Shell 脚本时显示 "declare not found" 的问题
- Windows的cmd终端连接android手机运行adb shell脚本命令
- 问题:Tomcat环境配置好后,在命令行内运行 startup 显示 不是内部命令
- Ubuntu下运行Shell脚本时显示“declare not found”的问题
- 解决windows 10 桌面右键时菜单显示出来需要很长时间的问题
- 如何解决Windows 8在桌面上总是显示大小写锁定和数字锁定图标的问题
- abd shell命令在windows 命令行下无法运行?
- windows cmd下输入命令,提示“不是内部或外部命令,也不是可运行的程序或批处理文件”的问题
- Win7 VS2010下开发的CS软件,安装到XP下无法运行或者桌面快捷方式无法显示图标的问题解决方法