NirCmd is a freeware utility that allows you to perform tasks from the command line, .bat files, desktop shortcuts and even是一个免费的实用工具,可以让你执行任务的命令行。蝙蝠档案,桌面捷径,甚至 Launchy . 。 There’sa large list of commands on the NirCmd website.还有大名单的命令NirCmd网站。 I’ve picked out a few that I’ve found useful, but you may find another great use for NirCmd after reading through the examples.我已经挑选了几个,我发现有用的,但你会发现另一个伟大的使用NirCmd读通过的例子。 This was written and tested in WindowsXP but it should also work in other versions of Windows.这是书面和测试WindowsXP ,但它也应该在其他版本的Windows 。
To get started download若要开始下载 NirCmd , the link is all the way at the bottom of the page. ,该链接是所有的方式在页面底部。 Next unzip the contents to a folder; I would suggest something simple such as C:\NirCmd\ if you use something else, substitute that wherever you see C:\NirCmd\下一步的内容解压缩到一个文件夹中;我想说的东西简单如 C : \ NirCmd \如果你使用别的替代,无论你看到ç : \ NirCmd \
Note: NirCmd may display as a virus, spyware, or potentially unwanted program on some anti-virus and anti-spyware programs (Sophos is one) this is because certain viruses and spyware include and use NirCmd to perform actions on the users PC.注: NirCmd可能会显示为病毒,间谍软件或潜在有害程序的一些反病毒和反间谍软件程序( Sophos公司之一) ,这是因为某些病毒和间谍软件包括和使用NirCmd执行行动对用户的PC 。 However it is also used by many good programs as well, such as UBCD (which I may cover later), and by itself it poses no risk.但是,它也被许多好节目,如UBCD (我可能包括更新) ,以及它本身不构成危险。
The simplest way to use NirCmd is in the command line, however this article will concentrate on writing commands out in a file and using desktop shortcuts and Launchy to run them.最简单的方法是使用NirCmd在命令行中,但是本文将集中于书面命令中的文件和使用的桌面快捷方式和Launchy来管理它们。 For a simple test, open up Notepad or your text-editor of choice and type in (or copy and paste):对于一个简单的试验,开拓记事本或您的文字编辑器的选择和输入(或复制并粘贴) :
C:\nircmd\nircmd.exe monitor off ç : \ nircmd \ nircmd.exe监测关闭
Save the file in your C:\NirCmd\ folder as MonitorOff.bat the exact name does not matter, but it should describe what it does.保存该文件在您的C : \ NirCmd \文件夹中MonitorOff.bat的确切名称并不重要,但应说明它。
Now you should have MonitorOff.bat sitting in the C:\NirCmd\ folder, double-click on it to put your monitor into power save mode (you can move the mouse or hit a key to turn it back on).现在您应该已经坐在MonitorOff.bat在 C : \ NirCmd \文件夹,双击它把你监测到省电模式(您可以移动鼠标或触及关键重新打开它) 。 You can then place a shortcut to MonitorOff.bat on your desktop, to do so Right-Click on MonitorOff.bat and select Send To and click Desktop (Create Shortcut) .然后,您就可以建立一个快捷方式MonitorOff.bat在您的桌面上,这样做右击MonitorOff.bat ,并选择发送 ,然后按一下桌面(创建快捷方式) 。 Another method I like to use is to simply select MonitorOff.bat with a single-click then hold down Alt and drag the file onto the desktop.另一种方法我喜欢使用是简单的选择MonitorOff.bat与单一点击然后按住Alt和拖动文件到桌面。
If you look carefully in the above screenshot, you’ll notice another .bat file titled wait2 screenshot.bat this one is a set of two commands to wait two seconds and then take a screenshot which is saved as shot.png in C:\Nircmd this comes in handy to capture a screenshot when you can’t just hit Ctrl + Print Screen which I what I normally use for screenshots.如果你仔细研究了上述画面,您会发现另一个。 bat文件名为wait2 screenshot.bat这是一套两个命令等待2秒钟,然后采取截图这是作为shot.png保存在 C : \ Nircmd这是在方便撷取画面时,你不能只是Ctrl键+打印屏幕 ,我就是我通常使用的画面。 Here is what the file contains:以下是该文件包含:
C:\nircmd\nircmd.exe cmdwait 2000 savescreenshot “C:\Nircmd\shot.png” ç : \ nircmd \ nircmd.exe cmdwait 2000年savescreenshot的“ C : \ Nircmd \ shot.png ”
Next up is a useful desktop shortcut to mute and un-mute the sound.接下来是一个有益的桌面捷径,以静音和取消静音的声音。 In a new file enter:在一个新的文件输入:
C:\nircmd\nircmd.exe cmdshortcut “~$folder.desktop$” “Mute Unmute” mutesysvolume 2 ç : \ nircmd \ nircmd.exe cmdshortcut “ 〜 $ folder.desktop $ ” , “静音Unmute ” mutesysvolume第2
Save the file in C:\NirCmd as Mute Unmute.bat you can also call change the “Mute Unmute” above in quotes to something else (the example on the website has “Switch Volume”), this will change the name of the desktop shortcut, you can also change any shortcut name later by right-clicking on it and selecting Rename .保存该文件在 C : \ NirCmd作为静音Unmute.bat您也可以要求改变“静音Unmute ”上面引号中的东西别人(的例子在网站上有“开关卷” ) ,这将更改名称的桌面快捷,您也可以变更任何捷径名称后, 右键点击它并选择重命名。 Now double-click on Mute Unmute.bat to create a new shortcut on your desktop that should mute the sound the first time it is double-clicked and un-mute it the next.现在双击静音Unmute.bat创建一个新的捷径在您的桌面上,应静音的声音第一次是双击,并取消静音它的下一个。 If the default icon for this is too boring for you, right-click the Mute Unmute shortcut on your desktop and select Properties , select the Shortcut tab on top and click the Change Icon button.如果预设的图标,这是太乏味了你,右击快捷静音Unmute在您的桌面上,并选择属性,选择快捷方式选项卡上,并点击更改图标按钮。 I personally like the speaker and music note icon as seen in the screenshot below.我个人喜欢扬声器和音乐音符图标可以看到在下面的截图。
The question that originally led me to NirCmd was someone wanting a quick way to switch resolutions, as she wanted a lower resolution for older programs.这个问题最初使我NirCmd是有人想快速切换的决议,因为她需要一个较低的分辨率为老年人程序。 For this example I will use 800×600 with 32 bit colors as the lower resolution and 1280×1024 with 32 bit colors as the higher resolution, although you can substitute other resolutions such as 1024×768 or widescreen resolutions such as 1440×900 and 1680×1050.在这个范例中我将使用800 × 600 32位色的较低分辨率和1280 × 1024的32位元色彩的更高的分辨率,但可以替代的其他决议,如1024 × 768或宽的决议,如1440 × 900和1680 × 1050 。 The last number, color depth should be 32 unless you are running very old programs and want 16 bit colors.最后数量,颜色深度应该是32 ,除非您运行的是非常古老的程序,并希望16位颜色。 First, for the lower resolution file enter:第一,对于较低分辨率的档案输入:
C:\nircmd\nircmd.exe cmdshortcut “~$folder.desktop$” “800×600″ setdisplay 800 600 32 ç : \ nircmd \ nircmd.exe cmdshortcut “ 〜 $ folder.desktop $ ” “ 800 × 600 ” setdisplay 800 600 32
and save it in C:\NirCmd as 800×600 Resolution.bat并保存在 C : \ NirCmd为800 × 600 Resolution.bat
Moving on to the larger resolution, make a new file with:转向较大的决议,作出新的文件:
C:\nircmd\nircmd.exe cmdshortcut “~$folder.desktop$” “1280×1024″ setdisplay 1280 1024 32 ç : \ nircmd \ nircmd.exe cmdshortcut “ 〜 $ folder.desktop $ ” , “ 1280 × 1024 ” setdisplay 1280 1024 32
and save it in C:\NirCmd as 1280×1024 Resolution.bat并保存在 C : \ NirCmd为1280 × 1024 Resolution.bat
Now you can double-click each of these to make desktop shortcuts called 800×600 and 1280×1024, double-click on the desktop shortcuts to quickly resize the desktop.现在您可以双击这些,使所谓的桌面快捷方式800 × 600和1280 × 1024 ,双击桌面上的快捷方式,迅速调整的桌面上。 As in the Mute Unmute example, you can change the icons to whatever you feel like, here are two I picked out of the default set, I’ll have to remember to do a post on custom icons in the future.如在静音Unmute例如,你可以改变图标,你感觉,这里有两个我挑选了默认的设置,我会记住这样一个职位自定义图标的未来。
![]()
Before moving into some more advanced command sets, I’ll explain how this can work with Launchy.前搬进一些更先进的指令集,我会解释如何能与Launchy 。 Launchy should already scan the desktop for shortcuts and therefore find the examples that created desktop shortcuts. Launchy应该已经扫描桌面的捷径,因此找到例子,创建桌面快捷方式。 However, you may not want to have all commands as desktop shortcuts, or you may want to type up commands on the fly.然而,您可能不希望所有的命令桌面快捷方式,或者您可能要键入命令的飞行。 To do either of these, the C:\NirCmd folder should be added to Launchy’s catalog.做这两种, 在 C : \ NirCmd文件夹中应补充Launchy的目录。 Bring up Launchy, Right-Click on it and select Options .造就Launchy ,右击它并选择选项。 Here click on the Catalog tab and hit the + (plus) button under Directories to add C:\Nircmd while it is selected type *.bat in the text-entry box under file types and hit the + button right underneath it.在这里单击目录选项卡,并击中+ (加号)按钮下的目录新增ç : \ Nircmd虽然它被选中输入*.蝙蝠在文字输入框中根据文件类型和击中右+按钮下面。 Do the same thing for *.exe, then make sure the box next to Executables is checked.做同样的事情为*.程序,然后确定旁边的方块可执行文件被选中。
Now click Rescan Catalog and Launchy should add all of your .bat files in the folder as well as nircmd.exe .现在点击重新目录和Launchy应增加您的所有。蝙蝠文件夹中的文件以及nircmd.exe 。 To try this, bring up Launchy and type:要尝试这一点,带出Launchy及类型:
MonitorOff
It should find the MonitorOff.bat before you finish typing, hit Enter to run it and it should turn off your monitor.它应该找到MonitorOff.bat您完成前打字,按Enter键运行它,并应关闭您的监视器。 All of the other .bat files created in C:\Nircmd should also be accessible by typing their filename in Launchy.所有其他。蝙蝠创建的文件在C : \ Nircmd也应该可以通过输入其文件名在Launchy 。

You can also enter an NirCmd command directly from Launchy, in the Launchy box type:您也可以输入一个命令NirCmd直接从Launchy ,在Launchy框中,键入:
nircmd
Next hit the Tab key and you should get nircmd -> in the launchy window.下一步打击Tab键,你应该得到nircmd -> “在l aunchy窗口。 You can then type any Nircmd command after the ->然后,您可以输入任何Nircmd命令后-> “
nircmd -> screensaver nircmd -> “屏幕保护程序
will turn on the screensaver.将打开屏幕保护程序。
There are a lot of commands and examples to try out, especially since you can have multiple commands in a single .bat file.有很多命令和例子来尝试,尤其是因为你可以有多个命令在一个单一。 bat文件。 Next up is a quick set of commands to tidy up Windows and logoff (good for a computer that has multiple users):下一步是一种快速的命令整理Windows和注销(良好的计算机有多个用户) :
C:\nircmd\nircmd.exe emptybin ç : \ nircmd \ nircmd.exe emptybin
C:\nircmd\nircmd.exe clipboard clear ç : \ nircmd \ nircmd.exe剪贴板明确
C:\nircmd\nircmd.exe exitwin logoff ç : \ nircmd \ nircmd.exe exitwin注销
Save this as Logoff.bat in C:\NirCmd\ and when you are ready , running it will empty all of the recycling bins, clear the computer and log off the current user, be sure to only test this once you want to logoff as it will close all of your windows including unsaved documents.另存为Logoff.bat在 C : \ NirCmd \ 当你已经准备就绪,运行,将空所有的回收箱,明确了计算机和注销当前用户,一定要仅此一次测试要注销的它将关闭所有的窗口,包括保存文件。
Note: Depending on your Launchy settings you may have to Rescan Catalog after making new .bat files or desktop shortcuts.注:根据您的Launchy设置您可能必须重新编录后,作出新的。蝙蝠的文件或桌面的快捷方式。 This option is on the General tab on the bottom as Minutes between catalog updates .这个选项是在常规选项卡上的底部之间的记录目录更新。 If you have it set to 0 which is for manual updates only , then you will have to rescan the catalog whenever you want new commands and shortcuts added to Launchy.如果您有它设置为0 ,这是手动只有升级 ,那么你将不得不重新扫描目录时,你想新的命令和快捷方式添加到Launchy 。
There are many more commands to cover, including ones that manipulate files, enter text, or even move and click the mouse.还有更多的命令,以支付,包括那些操纵文件,输入文字,甚至移动和点击鼠标。 Please feel free to leave a comment requesting additional help or examples.请随时发表评论,要求额外的帮助或例子。


























{ 6 comments… read them below or ( 6评论...阅读低于或 add one添加一个 } )
Haven’t had a good look at this yet, but I think it would be more useful with AutoHotKey than Launchy.没有一个良好的看待这个问题,但我想这会更有益与AutoHotKey比Launchy 。
Great tuto man!!大tuto男子!
Thanks!谢谢!
hey great even works with my launch app called key launch but i can only get monitor off and empty recycl;e bin to work any reasons why i cant get the resolution one to work and can you put more on嘿伟大甚至与我的作品推出所谓的关键应用发射,但我只能起飞和监控recycl空;电子邮件斌工作任何理由为什么我不能获得第一个工作,可以把更多的
Good tutorial, but is there any way to Switch User?良好的教学,但有什么办法来切换用户? Launchy itself will only allow you to Log Off so hoping NirCmd can add this. Launchy本身将只允许您登出,以便希望NirCmd可以补充一点。
Colin:科林:
I’m not sure off-hand why the monitor script is not working, I would check which resolutions you can use in your monitor’s display settings (right-click on the desktop and select properties and select the settings tab).我不知道了手,为什么监控脚本不工作,我要检查各项决议您可以使用您的监视器的显示设置(右键点击桌面并选择属性,选择设置标签) 。 Then try to set it to one of those resolutions with the command C:\NirCmd\nircmd.exe setdisplay 1024 768 32 or whatever resolution you need.然后尝试将其设置为其中的一个决议,命令ç : \ NirCmd \ nircmd.exe setdisplay 1024个768 32或任何你需要的决议。
Ian:伊恩:
I didn’t see any commands to switch user in the NirCmd documentation, however it is an active project where they will add new commands with each new version, so I would contact the dev team about getting it added for the next version.我没有看到任何命令切换用户在NirCmd文件,但它是一个积极的项目,他们将增添新的命令每个新版本,所以我将联系有关开发团队获得它说的下一个版本。 http://www.nirsoft.net/contact-new.html
I just configured launchy to use the killprocess command, on a window I specify in launchy.我只是配置launchy使用killprocess命令,在一个窗口中指定launchy 。
I used the ‘runner’ plugin for this.我用了'亚军'插件这一点。
I entered:我输入:
“C:\WINDOWS\system32\nircmd.exe”的“ C : \窗口\ system32 \ nircmd.exe ”
and和
” killprocess $$.exe” “ killprocess $ $的。 exe ”
By using this, i can pretty much do anything, istead of having to write a new batch file for every variable i need changed.利用这一点,我差不多可以做任何事情, istead不得不写一个新的批次档,每变我需要改变。
(oh, and btw, the reason why I put nircmd in system32, is because I can run nircmd command easier from ‘run’, without having to type where it is stored). (噢,生物及毒素武器,为什么我把nircmd在system32 ,是因为我可以运行nircmd命令容易从'经营' ,而不需要输入的地方是储存) 。
Leave a Comment发表您的评论