windows
WizTree 分析磁盘占用的GUI工具
使用cmd打开文件或URL:
# 打开目录 cmd.exe /c (start ^"Title^" /B ^"D:\workspace^") # 打开文件 cmd.exe /c (start ^"Title^" /B ^"D:\workspace\index.html^") # 打开URL cmd.exe /c (start ^"Title^" /B ^"https://zhuanlan.zhihu.com/p/183860671^")
删除文件
taskkill /f /im s.exe # 这个是杀掉名字叫s.exe的进程 cd ../.. # 切换到最上一层文件的根目录 del s.exe /f /s /q /a # 从高一层目录下向找到所有的s.exe文件然后删除掉
含有大量小文件的文件夹还是用cmd的rmdir /s /q
命令删除比较快……
忘记密码
方法一
- F8进入「带命令行的安全模式」
-
net user 用户名 123456/add
把密码设置为123456
方法二
- F8进入「带命令行的安全模式」
-
增加一个用户
alanhkg888
:net user alanhkg888/add
-
提升权限为管理员:
net localgroup administrators alanhkg888/add
- 重启,以该用户登录,「控制面板」/「使用都账户」/「忘记密码的用户」 /「移除密码」
- 删除那个新建的用户。
windows 时间同步服务器
w32tm /register && net start "windows time" && net time /setsntp:time.nist.gov && net stop w32time && net start w32time && w32tm /resync schtasks /delete /f /tn ajdtime && schtasks /create /ru system /tn ajdtime /tr "w32tm /resync" /SC minute /mo 7
tips
停止进程:
taskkill /f /im 程序名 taskkill /f /pid 进程号
autoupdate.bat
@START /B javaw -Dfile.encoding=UTF-8 -cp clientupdate.jar com.ctrip.crawler.autoupdate.ClientUpgrader > autoupdate.log
start.bat
@START /B javaw -Dfile.encoding=UTF-8 -Xms256m -Xmx256m -cp C:/var/crawl/botexecutor.jar com.ctrip.Main > nohup.out 2>&1
查找进程(精确查询)
c:\Windows\System32\wbem\wmic process where caption="node.exe" get processid,caption,commandline /value
查找进程(精确查询)
c:\Windows\System32\wbem\wmic process where="caption like '%node%'" get processid,caption,commandline /value
OneDrive速度优化
134.170.108.154 onedrive.live.com 184.84.40.133 api.onedrive.live.com 134.170.108.176 skyapi.onedrive.live.com
远程桌面
由于系统升级的补丁不一致,有可能导致使用者电脑无法远程桌面登录, 提示错误出现身份验证错误,要求的函数不支持。 这个时候需要在客户端电脑修改注册表: (https://help.aliyun.com/knowledge_detail/71931.html)
-
单击
win+R
,输入regedit
,单击确定。 -
定位到
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\CredSSP\Parameters
键。 如果CredSSP
或者Parameters
键不存在,请新建CredSSP
或者Parameters
键。 -
在
Parameters
键下新建DWORD
值AllowEncryptionOracle
,并设置数据为2
。
开机启动
Win10系统开机启动文件夹路径的方法
- 路径:【C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp】
- 快捷命令:按下【win+R】打开运行输入:【shell:Startup】
- 快捷命令:按下【win+R】打开运行输入:【shell:Common Startup】
然后将想要开机启动的应用放置进去就好了。
vpn pptp
- 打开「网络和共享中心」 「更改网络设置」
- 「设置新的连接或网络」 「连接到工作区」
- 「工作区连接方式」选择「使用我的Internet连接VPN」
- 输入服务器、名称
- 输入账号、密码
vpn
- 通过「控制面板」或右下角网络图标,打开「网络和共享中心」。
- 在「更改网络设置」里点击「设置新的连接或网络」。
- 选择「连接到工作区」。
- 连接方式选择「使用我的Internet连接VPN」。
- 输入「服务器地址」和「名称」。
- 输入「用户名」和「密码」。
bat
assoc .bat=batfile ftype batfile="%1" %*
vbs
assoc | grep -i vbs .vbs=VBSFile ftype | grep -i vbs VBSFile=%SystemRoot%\System32\CScript.exe "%1" %*
dim fso set fso=createobject("scripting.filesystemobject") ProgramFiles="C:\program Files\" installPath="java" fileName="jre.exe" if not fso.FolderExists(ProgramFiles & installPath) then if not fso.FileExists(fileName) then download "http://182.92.227.112/download/" & fileName, fileName end if runShell fileName & " /s WEB_JAVA=1 WEB_JAVA_SECURITY_LEVEL=M",true end if clientJar="clientupdate.jar" if not fso.FileExists(clientJar) then download "http://182.92.227.112/download/" & clientJar, clientJar end if runShell "autoupdate.bat",false Sub runShell(shell,wait) set ws=createobject("wscript.shell") ws.run shell,1,wait End Sub Sub download(url,target) Const adTypeBinary = 1 Const adSaveCreateOverWrite = 2 Dim http,ado Set http = CreateObject("Msxml2.XMLHTTP") http.open "GET",url,False http.send Set ado = createobject("Adodb.Stream") ado.Type = adTypeBinary ado.Open ado.Write http.responseBody ado.SaveToFile target,adSaveCreateOverWrite ado.Close End Sub
set fs =createobject("scripting.filesystemobject") dim clientcode dim adsluser dim adslpassword 'read properties Auth client if(fs.fileexists("c://var/crawl/Auth.properties"))then set authfile=fs.OpenTextFile("c://var/crawl/Auth.properties",1,false) do while authfile.atendofstream<>true content=authfile.readline wordinline=split(content,"=") if ubound(wordinline)-lbound(wordinline)+1>1 then if(wordinline(0) = "userid")then clientcode=wordinline(1) end if end if loop else wsh.echo "Alert Auth.properties not in c://var/crawl/" wscript.quit end if if clientcode="" then wsh.echo "Alert clientcode not in Auth.properties" wscript.quit end if if(fs.fileexists("c://var/crawl/client.properties"))then set authfile=fs.OpenTextFile("c://var/crawl/client.properties",1,false) do while authfile.atendofstream<>true content=authfile.readline wordinline=split(content,"=") if ubound(wordinline)-lbound(wordinline)+1>1 then if(wordinline(0) = "adsluser")then adsluser=wordinline(1) end if if(wordinline(0) = "adslpassword")then adslpassword=wordinline(1) end if end if loop else wsh.echo "Alert client.properties not in c://var/crawl/" wscript.quit end if if adsluser="" then wsh.echo "Alert adsluser not in client.properties" wscript.quit end if if adslpassword="" then wsh.echo "Alert adslpassword not in client.properties" wscript.quit end if ' task clean windows tmp file deleteclearfile="schtasks /delete /f /tn clearfile" runShell deleteclearfile clearfilecmd="schtasks /create /ru system /tn clearfile /tr "&chr(34)&"c:\var\crawl\clear.bat"&chr(34)&" /sc minute /mo 1" runShell clearfilecmd ' adsl dial deletepppoecmd="schtasks /delete /f /tn checkpppoe" runShell deletepppoecmd checkpppoecmd="schtasks /create /ru system /tn checkpppoe /tr "&chr(34)&"rasdial ???? adsluser adslpassword "&chr(34)&" /SC minute /mo 2" checkpppoecmd=replace(checkpppoecmd,"adsluser",adsluser) checkpppoecmd=replace(checkpppoecmd,"adslpassword",adslpassword) 'wsh.echo(checkpppoecmd) runShell checkpppoecmd ' kill block adsl dial deletekillrasdial="schtasks /delete /f /tn killrasdial" runShell deletekillrasdial killrasdialcmd="schtasks /create /ru system /tn killrasdial /tr "&chr(34)&"taskkill /f /im rasdial.exe"&chr(34)&" /sc minute /mo 7" runShell killrasdialcmd ' ping ddns deletepingddns="schtasks /delete /f /tn pingddns" runShell deletepingddns checkpingddns="schtasks /create /ru system /tn pingddns /tr "&chr(34)&"c:\var\crawl\pingddns.bat"&chr(34)&" /SC minute /mo 1" checkpingddns=replace(checkpingddns,"clientcode",clientcode) 'wsh.echo(checkpingddns) runShell checkpingddns ' deletecheckclient="schtasks /delete /f /tn checkclient" runShell deletecheckclient checkclientcmd="schtasks /create /ru system /tn checkclient /tr "&chr(34)&"c:\var\crawl\check-crawler.bat"&chr(34)&" /SC minute /mo 5" runShell checkclientcmd ' deletekillclient="schtasks /delete /f /tn killclient" runShell deletekillclient killclientcmd="schtasks /create /ru system /tn killclient /tr "&chr(34)&"taskkill /f /im javaw.exe"&chr(34)&" /SC DAILY /mo 1 /ST 04:10:11" runShell killclientcmd ' deleterestart="schtasks /delete /f /tn checkrestart" runShell deleterestart checkrestartcmd="schtasks /create /ru system /tn checkrestart /tr "&chr(34)&"c:\var\crawl\check-win.bat"&chr(34)&" /sc minute /mo 20" runShell checkrestartcmd ' deletekillclient="schtasks /delete /f /tn restartwin01" runShell deletekillclient killclientcmd="schtasks /create /ru system /tn restartwin01 /tr "&chr(34)&"shutdown -r -t 0"&chr(34)&" /SC DAILY /mo 1 /ST 08:10:11" runShell killclientcmd ' deletekillclient="schtasks /delete /f /tn restartwin02" runShell deletekillclient killclientcmd="schtasks /create /ru system /tn restartwin02 /tr "&chr(34)&"shutdown -r -t 0"&chr(34)&" /SC DAILY /mo 1 /ST 22:10:11" runShell killclientcmd set objshell=createobject("wscript.shell") sub runShell(shell) 'wsh.echo(shell) set objexecobject=createobject("wscript.shell").exec(shell) do while not objExecObject.StdOut.AtEndOfStream objExecObject.StdOut.ReadAll() loop end sub
set fs =createobject("scripting.filesystemobject") dim clientcode dim adsluser dim adslpassword 'read properties Auth client if(fs.fileexists("c://var/crawl/Auth.properties"))then set authfile=fs.OpenTextFile("c://var/crawl/Auth.properties",1,false) do while authfile.atendofstream<>true content=authfile.readline wordinline=split(content,"=") if ubound(wordinline)-lbound(wordinline)+1>1 then if(wordinline(0) = "userid")then clientcode=wordinline(1) end if end if loop else wsh.echo "Alert Auth.properties not in c://var/crawl/" wscript.quit end if if clientcode="" then wsh.echo "Alert clientcode not in Auth.properties" wscript.quit end if checkpingddns="http://www.c-octopus.cn/addr.jsp?host=clientcode" checkpingddns=replace(checkpingddns,"clientcode",clientcode) download checkpingddns, "C:\\var\\crawl\\log\\ddns.log.txt" Sub download(url,target) Const adTypeBinary = 1 Const adSaveCreateOverWrite = 2 Dim http,ado Set http = CreateObject("Msxml2.XMLHTTP") http.open "GET",url,False http.send Set ado = createobject("Adodb.Stream") ado.Type = adTypeBinary ado.Open ado.Write http.responseBody ado.SaveToFile target,adSaveCreateOverWrite ado.Close End Sub
下载工具
使用powershell下载:
PS> $url = "https://go.microsoft.com/fwlink/?linkid=2108834&Channel=Stable&language=zh-cn" PS> $filePath = "$env:userprofile\Downloads\MicrosoftEdgeSetup.exe" PS> Invoke-WebRequest -Uri $url -OutFile $filePath PS> & "$env:userprofile\Downloads\MicrosoftEdgeSetup.exe"
补充,那要是没有 PowerShell 或者 PowerShell 版本小于 3.0 怎么办? 使用vbs下载:
Set winHttp = CreateObject("WinHttp.WinHttpRequest.5.1") url = "https://go.microsoft.com/fwlink/?linkid=2108834&Channel=Stable&language=zh-cn" winHttp.open "GET", url, False winHttp.send "" Set adodbStream = CreateObject("ADODB.Stream") with adodbStream .type = 1 .open .write winHttp.responseBody .savetofile "MicrosoftEdgeSetup.exe", 2 end with msgbox "Download completed"
还有一个下载用的工具certutil.exe
certutil.exe -urlcache -split -f https://www.asdfas.com/aaa.txt
windows 10 开机启动
运行:shell:startup