Quick Tips

74 次浏览

VMware 提示与 Device/Credential Guard 不兼容

当我们在较新的 Windows 10 版本 (1909 或更新)使用 VMware Workstation(无论是 Pro 还是 Player 版本)时,会出现 WMware 与 Windows 自带的 Hyper-V 组件互不兼容的问题,从而报错:

“VMware Workstation and Device/Credential Guard are not compatible. VMware Workstation can be run after disabling Device/Credential Guard. Please visit http://www.vmware.com/go/turnoff_CG_DG for more details.”

解决方法:

  1. 开始 – 运行 (Win + R) – 键入 cmd as admin
  2. 在命令提示符键入 bcdedit /set hypervisorlaunchtype off
  3. 重启电脑,即可。

存在的问题:

禁用 Hyper-V 将直接导致依赖于 Hyper-V 的 Docker Desktop 无法正常启用,我们可以下载体验(Edge)版的 Docker Desktop 来禁用与 Hyper-V 相关的功能,并改用 Windows Container。

相关资料:

https://stackoverflow.com/questions/50374506/vmware-workstation-cannot-run-on-windows-10-after-recent-update-to-windows-10
https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=Windows-10-Client&redirectedfrom=MSDN
https://www.cnblogs.com/ups216/p/6385663.html

1,653 次浏览
1,026 次浏览

GitHub 提交忽略规则

我们可以在代码库的根目录创建一个名为 “.gitignore” 的文件,并在其中配置哪些文件或文件夹可以在提交的时候被忽略。以 .NET 项目为例,我们需要忽略与 VS 或 调试编译有关的 bin\obj\packages.vs 等文件或文件夹,则只需要:

# Emacs backup files
*~

appsettings.local.json
local.settings.json
*.pfx


# The below are a selected subset from
# https://github.com/github/gitignore/blob/master/VisualStudio.gitignore


# Visual Studio user-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# Build results
*.dll
*.dll.config
*.exe
*.exe.config
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Visual Studio 2015/2017 cache/options directory
.vs/

# Visual Studio 2017 auto generated files
Generated\ Files/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json

# Files built by Visual Studio
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap

# Visual Studio Trace Files
*.e2e

# Visual Studio code coverage results
*.coverage
*.coveragexml

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets

# Microsoft Azure Build Output
csx/
*.build.csdef

# Microsoft Azure Emulator
ecf/
rcf/

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/

# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/

注意,按行配置约束,一行一个。

790 次浏览

一键清除 .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 的磁盘空间,泪流满面!

1,634 次浏览
3,664 次浏览

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,376 次浏览

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

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

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer

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

1,785 次浏览

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