重新整理日常工作中Windows环境下的配置以及使用技巧。默认最前面的内容为最新的内容。
批量删除文件
开启远程桌面连接 mstsc
使用window defender阻止程序联网
mf.msc四哥分享的TreeSize里提到——“有新版了,很长时间未更新。用上面这个URL直接下载,Free版就够用。用wf.msc阻止TreeSize联网,这种软件绝对不能让它联网”
用Calibre给txt文件生成目录
来源——
- txt不带目录
- 添加txt到calibre
- 转换书籍 –> 结构检测 –> xpath表达式。使用如下转换正则表达式
//*[re:test(., "^\s*[第卷][0123456789一二三四五六七八九十零〇百千两]*[章回部节集卷].*", "i")]
Windows Terminal + Oh my posh
# 在powershell中查看$PROFILE的文件位置,编辑如下内容
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme JanDeDobbeleer
# 执行Get-PoshThemes可以看到有哪些主题可选,根据提示进行设置即可
Integrated:Font FamilyDejaVuSansMono Nerd FontMAS
Microsoft-Activation-Scripts,纯batchfile语言实现——
A collection of scripts for activating Microsoft products using HWID / KMS38 / Online KMS activation methods with a focus on open-source code, less antivirus detection and user-friendliness.
G出来这篇文章,使用的还是1.0版本,测试可用。强悍
chrome强制同步
chrome://syncLocal StateStop Sync(Keep Data)Trigger GetUpdatesStop Sync禁止chrome自动更新
Updatechromium download 各个平台的chrome历史版本
Electron devTools
Ctrl+Shift+IWSL
使用管理员权限打开PowersShell
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestartwinverdism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestartwsl --set-default-version 2代码: 0x80072EFD%localappdata%\Packages/mntwsl --listfile://wsl%24/Ubuntu-20.04/PC断电后,wsl网络异常
核心原因是PC端为WSL服务的虚拟网卡异常,导致wsl的网络无法访问网络。重置PC端的网络——使用管理员权限打开CMD命令行,重置如下的所有网络,然后重启PC
netsh winsock reset
netsh int ip reset all
netsh winhttp reset proxy
ipconfig /flushdns
/etc/resolv.conf# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 172.19.176.1
resolv.conf"resolv.conf" E166: Can't open linked file for writingstat /etc/resolv.conf File: /etc/resolv.conf -> ../run/resolvconf/resolv.conf
Size: 29 Blocks: 0 IO Block: 4096 symbolic link
Device: 810h/2064d Inode: 44358 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2021-07-02 08:38:47.580000000 +0800
Modify: 2021-05-31 11:27:04.000000000 +0800
Change: 2021-05-31 17:01:15.490000000 +0800
Birth: -
启动、移动
Using the WSL command line tool。将安装的应用移动到其他目录(默认安装到系统盘)
wsl --export Ubuntu-20.04 d:\20.04.tarwsl --import myubuntu d:\wsl\ubuntu20 d:\20.04.tarwsl -d myubuntuwsl -d myubuntu --user gebwsl --set-default myubuntuwsl --helpPS:可以在conEmu命令行启动,交互页面更友好一些;在linux下可以尝试使用下fish shell
PS C:\Users\joechin> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
部署映像服务和管理工具
版本: 10.0.19041.844
映像版本: 10.0.19043.1023
启用一个或多个功能
[==========================100.0%==========================]
操作成功完成。
PS C:\Users\joechin> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
部署映像服务和管理工具
版本: 10.0.19041.844
映像版本: 10.0.19043.1023
启用一个或多个功能
[==========================100.0%==========================]
操作成功完成。
PS C:\Users\joechin>
可以使用相同的逻辑转移默认的docker desktop data信息change the location of docker images
# 确保wsl关闭
wsl --shutdown
#查看所有的wsl
wsl --list -v
# 导出docker-desktop-data
wsl --export docker-desktop-data "D:\docker-desktop-data.tar"
# 取消注册
wsl --unregister docker-desktop-data
#重新导入
wsl --import docker-desktop-data "D:\wsl\docker-data" "D:\docker-desktop-data.tar" --version 2
转移chrome的user data数据
清理C盘的另外一个动作——
C:\Users\{username}\AppData\Local\JetBrainsHKEY_LOCAL_MACHINE or HKEY_CURRENT_USER\Software\Policies\Google\Chrome\UserDataDir插件Remote-WSL登录问题
wsl: allow to run with a non-default user 看起来目前无法做到使用“非默认用户root”登录的要求。官方文档所谓“specific settings”指的时连接到wsl之后针对编辑器、命令行等工具的配置。
wsl -u username -d ubuntu20/etc/wsl.conf# /etc/wsl.conf
[user]
default=username
断电重启后自动修复失败
异常断电,重新供电后,系统自动加电。但此时系统无法正常启动,需要长按电源键关机。然后重新开机——之前这样操作之后,系统可以正常启动。
昨天遇到的新场景是:重新启动后,进入“自动修复”提示,然后提示“无法正常启动”。提供了两个选项,blabla之类的。高级选项里再次重启或再次修复——还是无法正常启动。拆开机箱,重新插拔一下接口、内存条之类的也不好使(基本都是碰运气的操作- -|)
win10自动修复失败无法开机官方论坛里这个方法可行:
开机进入系统时长按电源键强制关机,然后再次开机。重复上面的步骤 3 次,再开机会进入高级恢复界面。
点击 “疑难解答” 选项,接着点击 “高级选项”,点击 “启动设置”,点击 “重启”,选择安全模式。如果可以进入安全模式
关键操作:进入安全模式启动一次。(可以正常启动,安全模式下系统无法链接网络)
问题是异常断电导致的,所以在安全模式下也不需要做任何操作。选择“重启”。恢复正常。
wmic path Win32_OperatingSystem get LastBootUpTime回收站
不通过快捷图标,两种直接进入回收站方式
explorer.exe ::{645FF040-5081-101B-9F08-00AA002F954E}Goland 试用 (2022年1月3购买正版授权)
恢复试用IntelliJ IDEA介绍了idea的恢复,Goland作为同一家产品适用相同的逻辑
reg.exe query "HKCU\SOFTWARE\JavaSoft\Prefs\jetbrains\goland\99999999\evlsprt3" /v "202"%APPDATA%\JetBrainsevlsprtevlsprt2GoLand2020.3/evalPermanentDeviceIdPermanentDeviceIdblcrlGoLand2020.3/optionsother.xmlother.xmlPermanentDeviceIdPermanentDeviceIdGoland 链接数据库
同一个数据库,在IntelliJIdea2021.1里连接可以正常连接成功;在GoLand2021.1里连接提示如下问题(似乎是升级之前可以连接成功)
[08S01]
Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate).
根据提示,应该是下面四种问题之一—— No appropriate protocol
- The TLS implementation used by the client does not support the cipher suites used by the server’s certificate.
- The TLS configuration on the server has disabled cipher suites supported by the client.
- The TLS configurations on the client disable cipher suites offered by the server.
- TLS version incompatibility between the client and server.
根据环境条件,看起来是Goland这个版本的问题,下搁置一下。官方也有类似的issue在跟踪: Can’t connect to remote MySQL since last version of IntelliJ
仔细看下上面的issue跟踪,包含了解决方法:
TLSv1.2data source propertiesenabledTLSprotocolsTLSv1,TLSv1.1,TLSv1.2,TLSv1.3If you are running MySQL 8.0, 5.7.28, 5.6.46 and later and your server is configured with TLSv1.2 you can enabled it in driver: open up data source properties, switch to Advanced tab and set value for enabledTLSprotocols to TLSv1,TLSv1.1,TLSv1.2,TLSv1.3
另外一个解决方法思路相同,只不过是通过配置文件的方式进行配置——
Workaround #1
TLSv1jdk.tls.disabledAlgorithmscustom.java.securityjdk.tls.disabledAlgorithms=SSLv3, TLSv1.1, RC4, DES, MD5withRSA, \
DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
include jdk.disabled.namedCurves
TLSv1-Djava.security.properties=${PATH_TO_FILE?}/custom.java.security${PATH_TO_FILE?}win 10 锁屏不断网
关键是将网卡的对应设置:“允许计算机关闭此设备以节约电源” 取消勾选。无线/有线网卡找到对应的网卡驱动——
设备管理器:
- 无线网卡: 右击-属性-电源管理
- 有线网卡:右击-属性-配置-电源管理
an attempt was made to access a socket in a way forbidden by its access permissions
看起来docker-for-win的副作用太大了
开发时监控2020端口时,应用提示试图打开一个禁止的socket端口。
netstat -anoGet-NetTCPConnection |findstr还好我先google而不是先执行第三步操作。原因是windows默认排除了这些端口范围——
netsh interface ipv4 show excludedportrange protocol=tcpD:\>netsh interface ipv4 show excludedportrange protocol=tcp
协议 tcp 端口排除范围
开始端口 结束端口
---------- --------
1615 1714
1715 1814
1915 2014
2015 2114
7275 7374
50000 50059 *
* - 管理的端口排除。
所以快捷解决方式就是不使用以上范围内的端口。
Docker for Windows and Hyper-V are responsible for all of those excluded port ranges above.- Disable hyper-v (which will required a couple of restarts)
dism.exe /Online /Disable-Feature:Microsoft-Hyper-V- When you finish all the required restarts, reserve the port you want so hyper-v doesn’t reserve it back
netsh int ipv4 add excludedportrange protocol=tcp startport=50051 numberofports=1- Re-Enable hyper-V (which will require a couple of restart)
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /Allpython命令打开了windows store
python.exepython3.exepython2 和python3 同时存在的情况下,将对应的目录添加到环境变量,然后修改其中一个exe启动文件的名称即可。
youtube-dl
pip install --upgrade youtube-dlyoutube-dl -F https://www.youtube.com/watch?v=x0uinJvhNxIyoutube-dl -f 136 https://www.youtube.com/watch?v=x0uinJvhNxI注意列表中的格式,有些是只有视频没有音频的文件。
youtube-dl -f bestvideo+bestaudio https://www.youtube.com/watch?v=x0uinJvhNxIYou have requested multiple formats but ffmpeg or avconv are not installed. The formats won't be merged.
这个命令需要本地安装有ffmpeg或avconv(用来自动将音视频合成),可以从这里下载ffmpeg的zip包,解压后将bin目录添加到环境变量。
# check list
# youtube-dl -F https://www.youtube.com/watch?v=x0uinJvhNxI
[youtube] x0uinJvhNxI: Downloading webpage
[info] Available formats for x0uinJvhNxI:
format code extension resolution note
249 webm audio only tiny 63k , opus @ 50k (48000Hz), 123.69MiB
250 webm audio only tiny 75k , opus @ 70k (48000Hz), 154.79MiB
251 webm audio only tiny 130k , opus @160k (48000Hz), 275.97MiB
140 m4a audio only tiny 150k , m4a_dash container, mp4a.40.2@128k (44100Hz), 319.05MiB
160 mp4 256x144 144p 118k , avc1.4d400c, 30fps, video only, 30.87MiB
278 webm 256x144 144p 205k , webm container, vp9, 30fps, video only, 68.27MiB
242 webm 426x240 240p 262k , vp9, 30fps, video only, 92.25MiB
133 mp4 426x240 240p 271k , avc1.4d4015, 30fps, video only, 52.00MiB
243 webm 640x360 360p 432k , vp9, 30fps, video only, 172.66MiB
134 mp4 640x360 360p 680k , avc1.4d401e, 30fps, video only, 106.63MiB
244 webm 854x480 480p 736k , vp9, 30fps, video only, 267.36MiB
135 mp4 854x480 480p 1241k , avc1.4d401f, 30fps, video only, 176.36MiB
247 webm 1280x720 720p 1284k , vp9, 30fps, video only, 497.02MiB
136 mp4 1280x720 720p 1871k , avc1.4d401f, 30fps, video only, 290.41MiB
248 webm 1920x1080 1080p 2332k , vp9, 30fps, video only, 872.66MiB
137 mp4 1920x1080 1080p 3200k , avc1.640028, 30fps, video only, 453.62MiB
22 mp4 1280x720 720p 246k , avc1.64001F, 30fps, mp4a.40.2@192k (44100Hz)
18 mp4 640x360 360p 262k , avc1.42001E, 30fps, mp4a.40.2@ 96k (44100Hz), 647.47MiB (best)
# actual downlaod
youtube-dl -f bestvideo+bestaudio https://www.youtube.com/watch?v=x0uinJvhNxI
[youtube] x0uinJvhNxI: Downloading webpage
[download] Resuming download at byte 337521534
[download] Destination: Flutter Crash Course for Beginners 2020 - Build a Flutter App with Google's Flutter & Dart-x0uinJvhNxI.f137.mp4
[download] 100% of 453.62MiB in 02:08
[download] Destination: Flutter Crash Course for Beginners 2020 - Build a Flutter App with Google's Flutter & Dart-x0uinJvhNxI.f140.m4a
[download] 100% of 319.05MiB in 05:08
[ffmpeg] Merging formats into "Flutter Crash Course for Beginners 2020 - Build a Flutter App with Google's Flutter & Dart-x0uinJvhNxI.mp4"
Deleting original file Flutter Crash Course for Beginners 2020 - Build a Flutter App with Google's Flutter & Dart-x0uinJvhNxI.f137.mp4 (pass -k to keep)
Deleting original file Flutter Crash Course for Beginners 2020 - Build a Flutter App with Google's Flutter & Dart-x0uinJvhNxI.f140.m4a (pass -k to keep)
ffmpeg create video
七年前在饭否记录了一颗树的四季
>ffmpeg -r 5 -i E:\00D\qishimg\%3d.jpg -c:v libx264 E:\00D\images.mp4效果展示
001.jpg002.jpg003.jpgffmpeg -f image2 -i E:\00D\%3d.jpg E:\00E\imagestovideo.mp4ffmpegBufferedImage croppedImage = originalImage.getSubimage(x, y, width, height);Mac PC远程访问Window PC
Bose耳机蓝牙连接Mac电脑
- 手机上下载APP"Bose Connect"
- 打开耳机,用APP连接手机和耳机
- 打开APP,点里面左下角那个蓝牙符号,然后选择"连接新设备"
- 在Mac的偏好设置的蓝牙里,就可以找到耳机了,连接即可用
Eclipse报错SWTError: No more handles
Caused by: org.eclipse.swt.SWTError: No more handles!ENTRY org.eclipse.osgi 4 0 2020-07-15 16:12:47.033
!MESSAGE Application error
!STACK 1
org.eclipse.swt.SWTException: Failed to execute runnable (org.eclipse.swt.SWTError: No more handles)
at org.eclipse.swt.SWT.error(SWT.java:4723)
at org.eclipse.swt.SWT.error(SWT.java:4638)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:188)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3897)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3527)
at org.eclipse.swt.widgets.Display.release(Display.java:3579)
at org.eclipse.swt.graphics.Device.dispose(Device.java:276)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:166)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
at org.eclipse.equinox.launcher.Main.run(Main.java:1447)
Caused by: org.eclipse.swt.SWTError: No more handles
at org.eclipse.swt.SWT.error(SWT.java:4749)
at org.eclipse.swt.SWT.error(SWT.java:4638)
at org.eclipse.swt.SWT.error(SWT.java:4609)
at org.eclipse.swt.widgets.Widget.error(Widget.java:432)
at org.eclipse.swt.widgets.Control.internal_new_GC(Control.java:1771)
at org.eclipse.swt.graphics.GC.<init>(GC.java:171)
at org.eclipse.swt.graphics.GC.<init>(GC.java:135)
at org.eclipse.swt.custom.CTabFolder.updateTabHeight(CTabFolder.java:3838)
at org.eclipse.swt.custom.CTabFolder.runUpdate(CTabFolder.java:3871)
at org.eclipse.swt.custom.CTabFolder.lambda$3(CTabFolder.java:3861)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
... 17 more
官方这个issue的comment有建议修改注册表:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\GDIProcessHandleQuota准备按照这个提示操作。本机默认值为 2710
Windows 8 and later, the system wide GDI Objects are limited to max out at 65,536; and the maximum single process is 16,384.
最多的GDI对象为65536个(2的16次方),单个进程最多16384个
The default limit set by Windows for any single process is 10,000 GDI objects. If your application GDI Objects exceeds this amount, that process is likely to crash.
默认的单进程GDI对象为10000个,如果超出,则可能崩溃
详细信息选择列GDI对象用户对象- Open Task Manager (right click on start bar > Task Manager OR through CTRL+ALT+DEL)
- Click on ‘Details’ Tab
- Right click on one of the columns and click on ‘Select Columns’
- Tick the GDI objects
注意Eclipse中打开的项目的报错信息,即使处理错误信息。我只是清理了错误日志,重新打开Eclipse又OK了。另外,重启大法也好使。
禁止升级
AU DWORD (32-bit)AUOptions22 — Notify for download and auto install.
3 — Auto download and notify for install.
4 — Auto download and schedule the install.
5 — Allow local admin to choose settings.
多桌面+分屏
类似Mac上的三指滑动切换工作桌面的效果。
任务视图新建桌面WinCtl三屏、四屏相同操作。鼠标拖拽到边缘,触发半透明背景展示的大小(二分之一、四分之一)
ConEmu
在新tab页面批量执行不同的任务。official doc
C:\Users\userNamestartHugoSite.bat#启动hugo站点
D:
cd D:/openSources/site/hugositefolder
hugo server --watch --verbose --buildDrafts
startJekyllSite.bat# 启动jekyll站点
D:
cd D:/openSources/site/jekyllsitefolder
bundle exec jekyll serve
startDesktop.bat#启动桌面应用
D:
cd D:\openSources\site\desktop-app
yarn electron:serve
startAll.bat@echo off
echo start trio
# https://superuser.com/a/593648
start "trio" "D:\tools\conEmu\ConEmu64.exe" /cmdlist ^> cmd /k startHugoSite.bat ^|^|^| cmd /k startJekyllSite.bat ^|^|^| cmd /k startDesktop.bat
echo finish jobs.
上述命令会新启动一个ConEmu窗口并在其中打开三个tab页面,分别执行三个启动脚本。强迫症如我,就主动退出当前窗口。使用新创建的window了。
start "c" cmd /k call b.bat- “trio”是一段字符串,代表新打开的cmd窗口的名字,可以随便起名。
- /k是表示新打开的cmd窗口在执行完命令后保存打开状态,如果希望执行完就关闭窗口就使用/c
call- call b.bat表示call命令,即调用b.bat文件;该命令可以用”“括起来,即:”call b.bat”
Word里替换换行符
^p^l^p设置命令行代理
# 持续到cmd窗口关闭,非 系统环境变量
set http_proxy=http://127.0.0.1:1189
set https_proxy=http://127.0.0.1:1189
# 删除此变量的值。只需要在等号后不设置值即可。
set http_proxy=
# echo a new empty line
echo[
echo(
echo.
命令行查看MD5值
certutil -hashfile xxx MD5
certutil -hashfile xxx SHA1
certutil -hashfile xxx SHA256
outlook证书弹出提示
- 查看证书;
- 选择安装证书;
- 选择自定义的存储区;
- 选择"受信任的根证书颁发机构”
(因为自定义的证书通常没有其他证书的签名,所以需要接受为“根证书”)
修改用户名
How to Change Your Account Name in Windows 10 How to Find Security Identifier (SID) of User in Windows Security identifiers official doc
wmic useraccountPS D:\> whoami /user
用户信息
----------------
用户名 SID
================ ==============================================
gebitang\joechin S-1-5-21-3801529287-1954174758-2671260994-1001
PS D:\>
基本流程:
regedit HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Profilelist netplwiznetplwizcontrol userpasswords2win10 鼠标一直显示转圈
通常为有应用一直在占用资源。我遇到的是 小米wifi网口一直未启动导致的(拔掉小米wifi后恢复正常),在设备管理器–>网络适配器中的adapter有个向下的箭头,右键可以选择启用设备。启用设备后,转圈提示消失。
系统自检wifi热点(需要无线网卡支持)
推荐使用小米wifi:即可以提供wifi热点给其他设备使用;又可以作为无线网卡连接其他wifi上网。
#0. 使用管理员权限运行cmd命令行
#1. 检查是否包含无线网卡 (没有无线网卡的就不可用)
netsh wlan show driver
接口名称: WLAN
驱动程序 : Broadcom BCM943228HMB 802.11abgn 2x2 Wi-Fi Adapter
供应商 : Broadcom
提供程序 : Broadcom
日期 : 2014/6/9
版本 : 6.30.223.245
INF 文件 : C:\windows\INF\oem46.inf
文件 : 4 total
C:\windows\system32\DRIVERS\BCMWL63a.SYS
C:\windows\system32\bcmihvsrv64.dll
C:\windows\system32\bcmihvui64.dll
C:\windows\system32\drivers\vwifibus.sys
类型 : 本机 WLAN 驱动程序
支持的无线电类型 : 802.11n 802.11a 802.11g 802.11b
支持 FIPS 140-2 模式: 是
支持 802.11w 管理帧保护 : 是
支持的承载网络 : 是
基础结构模式中支持的身份验证和密码:
开放式 无
开放式 WEP
WPA2 - 企业 TKIP
WPA2 - 个人 TKIP
WPA2 - 企业 CCMP
WPA2 - 个人 CCMP
供应商定义的 供应商定义的
供应商定义的 供应商定义的
WPA - 企业 TKIP
WPA - 个人 TKIP
WPA - 企业 CCMP
WPA - 个人 CCMP
临时模式中支持的身份验证和密码:
WPA2 - 个人 CCMP
开放式 无
开放式 WEP
是否存在 IHV 服务 : 是
IHV 适配器 OUI : [00 10 18],类型: [00]
IHV 扩展 DLL 路径 : C:\windows\System32\bcmihvsrv64.dll
IHV UI 扩展 ClSID : {aaa6dee9-31b9-4f18-ab39-82ef9b06eb73}
IHV 诊断 CLSID : {00000000-0000-0000-0000-000000000000}
#2. 创建无线热点 网络连接中会多出一个网卡“Microsoft Virtual WiFi Miniport Adapter”
# mode:是否启用虚拟WIFI网卡,改为disallow则为禁用。
# ssid:无线网名称,最好用英文(以cai为例)。
# key:无线网密码,
netsh set hostednetwork mode=allow ssid=nameOfwifi key=pwdForssid
承载网络模式已设置为允许。
已成功更改承载网络的 SSID。
已成功更改托管网络的用户密钥密码。
#3. 启动/停止此连接 netsh wlan start/stop hostednetwork
C:\windows\system32>netsh wlan start hostednetwork
已启动承载网络。
#4. 设置本地的有线连接为共享模式
在“网络连接”窗口中,右键单击已连接到Internet的网络连接,
选择“属性”→“共享”,勾上“允许其他······连接(N)”并选择新创建的wifi连接点
netsh wlan set hostednetwork mode=allow ssid=cai key=12345678
开机自启动
#1. 编辑注册表 Ctrl+R --> regedit
计算机\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
#2. 右键新建 "字符串"" 类型,自定义名字
#3. 知道该名称的数据值,即要启动应用的全目录,如 F:\Tools\ss\Shadowsocks.exe
# win10环境可以直接启动powershell类型脚本。
# a). 新建脚本保存为.ps1的后缀; b). 修改默认打开应用,选择 powershell
#(默认路径在 %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe)
# 即 %HOMEDRIVE%%HOMEPATH% = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
关闭skype自启动
主页-->应用-->启动获取时间戳
格式: %date:~x,y%以及%time:~x,y% 说明: x是开始位置,y是取得字符数
# 获取完整的日期和时间,
格式: %date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%
结果: 20180316175313
bat 执行多条命令
命令1 & 命令2 & 命令3 … (无论前面命令是否故障,照样执行后面)
命令1 && 命令2 &&命令3… (仅当前面命令成功时,才执行后面)
命令1 || 命令2 || 命令3… (仅当前面命令失败时.才执行后面)
bat注释
在批处理中,段注释有一种比较常用的方法:
goto start
= 可以是多行文本,可以是命令
= 可以包含重定向符号和其他特殊字符
= 只要不包含 :start 这一行,就都是注释
:start
这样会跳过之间的三行,也就相当于注释
另外,还有其他各种注释形式,比如:
- :: 注释内容(第一个冒号后也可以跟任何一个非字母数字的字符)
- rem 注释内容(不能出现重定向符号和管道符号)
- echo 注释内容(不能出现重定向符号和管道符号)〉nul
- if not exist nul 注释内容(不能出现重定向符号和管道符号)
- :注释内容(注释文本不能与已有标签重名)
- %注释内容%(可以用作行间注释,不能出现重定向符号和管道符号)
- goto 标签 注释内容(可以用作说明goto的条件和执行内容)
- :标签 注释内容(可以用作标签下方段的执行内容)
CMD重定向
# 2>&1
java -Dshow.debug.info=true -jar ./App.jar >> log-%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%.txt 2>&1
PowerShell 执行 mvn -D 参数问题
mvn clean package assembly:assembly -Dmaven.test.skip=truemvn clean package assembly:assembly '-Dmaven.test.skip=true'杀死进程
#命令行杀死进程
#查看进程
tasklist
#杀死进程 查看帮助 taskkill /?
taskkill /PID 11112
# 强制kill
taskkill /F /PID 4684
taskkill /IM notepad.exe
bat目录提示‘此处不该有xxx’
@echo off
set port=%1
set EXISTS_FLAG=false
for /f "tokens=2" %%i in ('netstat -ano ^|findstr ":%port%"') do echo %%i|findstr /E ":%port%" && set EXISTS_FLAG=true && exit
for/f中的命令如果有特殊字符需要加转义字符^,您的批处理改成这样就行了。
提高CMD显示行数
修改属性、布局、屏幕缓冲区大小、高度。
如果命令行输出被截断,进行重定向吧:(
mode命令显示当前窗口设置状态
F:\>mode
设备状态 CON:
---------
行: 3000
列: 80
键盘速度: 31
键盘延迟: 1
代码页: 936
窗口保护色 #c7edcc
202 234 206 #caeace
199 237 204 #c7edcc
# HKEY_CURRENT_USER\Control Panel\Colors\下的Window的值默认为255 255 255(白色), 设置为199 237 204(浅绿)
# HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\DefaultColors\Standard下的Window的数值默认 ffffff,修改为
CMD here for win10
How to return the ‘Open command window here’ option to Windows 10’s context menu这个链接操作了半天还是不好使。直接修改注册表吧,不能迷信外语资料:)
报错下面的内容到文本文件,重命名为.reg,双击执行即可。
说明:修改不同的注册表值。
给以下注册表添加了新内容: [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell] 增加一个条目cmd_here:指定名称、icon和执行的命令
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell] 增加一个条目cmdPrompt:指定名称、icon和执行的命令
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell] 增加一个条目cmd_here:指定名称、icon和执行的命令
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\cmd_here]
@="cmd here"
"Icon"="cmd.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\cmd_here\command]
@="\"C:\\Windows\\System32\\cmd.exe\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmdPrompt]
@="cmd here"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmdPrompt\command]
@="\"C:\\Windows\\System32\\cmd.exe\" \"cd %1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_here]
@="cmd here"
"Icon"="cmd.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_here\command]
@="\"C:\\Windows\\System32\\cmd.exe\""
Notepad++ 插件管理
默认的安装是不带PluginManager的,官方下载,指向到github地址。 32为的选择后缀为UNI的,下载解压到对应的安装目录plugin、update文件夹下。
通常用的三个插件:compare、JSON Viewer、XML tools。通过PM安装、重启即可。
离线安装插件
高版本(v8.4.5)上已经自带PluginManager,下载对应的plugin:通常为 .dll 文件。在plugin文件夹下创建同名的文件夹名称,保存对应的 .dll 文件。重启应用即可
经纬度查询告别百度
基本告别百度了。搜索“经纬度查询”,第一页没看到可用的信息。
search map bylatitude and longitude更简单的是直接在map的搜索框里输入经纬度值即可。支持三种数值格式。
39°57'26"N 116°30'19"EEnter coordinates to find a place
- On your computer, open Google Maps.
- In the search box at the top, type your coordinates. Here are examples of formats that work:
- Degrees, minutes, and seconds (DMS): 41°42'04.0"N 86°44'29.0"E
- Degrees and decimal minutes (DMM): 41 24.2028, 2 10.4418
- Decimal degrees (DD): 41.701111, 86.741389
- You’ll see a pin show up at your coordinates.
Get the coordinates of a place
- On your computer, open Google Maps. If you’re using Maps in Lite mode, you’ll see a lightning bolt at the bottom and you won’t be able to get the coordinates of a place.
- Right-click the place or area on the map.
- Select What’s here?
- At the bottom, you’ll see a card with the coordinates.
Tips for formatting your coordinates
Here are some tips for formatting your coordinates so they work on Google Maps:
41,40338, 2,1740341.40338, 2.17403A记录查询
make a DNS lookup:
Enter domain name (trailing dot will be auto-appended).
Lookup and enjoy the output.
从结果来看,后两个工具信息更准确。下一步可以着手自动化处理
comments powered by Disqus