Windows

861 次浏览

一键清除 .NET 无用文件,清爽一夏

工作几年,电脑里会有很多项目代码,随之而来的就是许许多多调试、编译时带来的 bin/obj/package 或者 .vs 文件(夹),如何清除这些文件,来一个大扫除呢?这里提供一个超有效的 Batch 脚本供参考。

@echo off
REM start to clean code folder
echo Start to clean all code folder

@for /d /r %%c in (obj) do @if exist "%%c" (@rd /s /q "%%c" & echo Delete %%c)
@for /d /r %%c in (bin) do @if exist "%%c" (@rd /s /q "%%c" & echo Delete %%c)
@for /d /r %%c in (packages) do @if exist "%%c" (@rd /s /q "%%c" & echo Delete %%c)
@for /d /r %%c in (.vs) do @if exist "%%c" (@rd /s /q "%%c" & echo Delete %%c)

echo Done.

存储为 .bat 文件后,通过命令提示符运行,在我的电脑上运行后,整整节约了 15G 的磁盘空间,泪流满面!

3,811 次浏览

Quick Tips: Open CMD here | 在当前位置打开命令行

We can right-click the mouse with Shift key to find the "Open command here" or "Open PowerShell window here" item to open the command line at current location.

But we often need to run the command line as an administrator, so you could register the following value to Windows Register to add a new item "Open command (as Admin) here" to Windows Explorer right-click menu.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
"Icon"="c:\\windows\\system32\\cmd.exe"
"MUIVerb"="Open command (as Admin) here"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

[HKEY_CLASSES_ROOT\folder\shell\runas]
"Icon"="c:\\windows\\system32\\cmd.exe"
"MUIVerb"="Open command (as Admin) here"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\folder\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

Open the Notepad and paste the text of above, save the file as OpenCMDHere.reg, and then double click this file, and click the "Yes" button in the message box.

The meaning of the above code is that we will create a new Windows shell item called "runas" at folder and the empty space in a folder, and set the Icon and propmt text.

HKEY_CLASSES_ROOT\Directory\shell, the context menu when you right-click on a folder
HKEY_CLASSES_ROOT\Directory\background, the context menu when you right-click on the "background" empty space while in a folder 

Then to define the running command of "runas" item:

cmd.exe /s /k pushd \"%V\"

That means to run the cmd.exe at the current working folder, the /k carries out the command specified by the following string so it executes the command pushd %V and since the only argument pushd accepts is a path it follows that %V a variable delivered by explorer that contains the path of the folder right clicked.

See more:
cmd command, https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490880(v%3dtechnet.10)
Pushd command, https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490978(v=technet.10)


我们可以在 Windows 的任意位置,通过 按下 Shift + 鼠标右键,来在当前位置启动 CMD 或 PowerShell。

但是,我们经常需要以管理员身份取运行 CMD,所以我们可以通过加载上述的值到注册表,来为右键菜单添加一个新的选项。将上述值保存到一个记事本中,并保存为 .reg 文件,然后双击运行,在后续提示中都选择 是,即可。

1,413 次浏览

IE 无法正常打开,刚启动就关闭

如果你的电脑出现了 IE 无法正常启动,总是刚一点击就自动关闭的情形。那么你可以通过以下步骤进行修改,开始 -> 运行 -> regedit ,进入注册表,在其中找到:

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer

的 Main 主键,右键单击Main主键,选择“权限”,在弹出的权限设置对话框里点“高级”按钮,在高级窗口里点击下面的“启用继承”按钮,即可。

1,893 次浏览

Memo: 关于 Windows 10 使用的几个小提示

前几个月把单位和家里的电脑都升级到了 Windows 10 ,升级很顺利,使用起来也非常流畅。这里有几个小提示大家可以参考下:
(个人十分建议执行全新安装,通过近2个月的使用,升级版的 Windows 10 还是会出现一些奇葩问题的,比如过了一段时间 Windows Explorer 和 Microsoft Edge 经常性的自动重启,Skype、百度输入法莫名卡死等问题,但是全新安装的版本,并没有出现过这一类的问题)

1 如果是从 Windows 7/8 升级至 Windows 10 ,希望删除系统盘中旧版本 Windows 的文件(Windows.old),可以执行如下操作:
(1) 打开“这台计算机(This PC)”, 在C:盘上点击右键,选择属性
(2) 在常规页下,点击“磁盘清理(Disk Cleanup)”,稍等片刻后,点击新页面中的”清理系统文件(Clean up system files)”按钮
(3) 勾选中“以前版本的Windows安装(Previous Windows installation(s))”,点击确认,即可。

2 在使用Windows 10的过程中,如果希望快速切换多任务桌面,可以使用快捷键
Ctrl + Win + ←/→
也可以通过
Ctrl + Win + D 来新建 多任务桌面
或者使用
Ctrl + Win + F4 来关闭 多任务桌面
Continue reading