自由學習的風

幽夢影 張潮 少年讀書,如隙中窺月;中年讀書,如庭中望月;老年讀書,如臺上玩月。皆以閱歷之淺深,為所得之淺深耳。
顯示具有 Windows 標籤的文章。 顯示所有文章
顯示具有 Windows 標籤的文章。 顯示所有文章

[系統]隱藏某個Windows 更新項目

2021年4月7日 星期三

 之前在 Windows 7 時代,可以在更新項目中直接選擇將某些更新隱藏起來不更新,結果到了 Windows 10 就把這項功能移除掉了。

本來也沒啥問題,不過,Windows 最近的更新又出包了,我有一台  20H2 一直會更新 KB5000802 這支更新檔,造成反覆更新、反覆開機,上網查了一下,嘿!原來得自己去官網下載程式才提供。

PS: 不過,很奇怪的是…官網搜尋到的下載網址顯示 File Not Found...只能找其它資訊站台 :(



參考文章:Show or Hide Updates Tool will block unwanted Windows Updates in Windows 10
下載網站:Downloading Microsoft Show or Hide Updates Troubleshooter

[Windows] 磁碟分割工具 - diskpart

2020年6月18日 星期四

fdisk 就讓它成為過去吧!
diskpart 似乎能處理的比較完整…

截錄----------------------------------------------

使用 diskpart /s 來執行腳本,以自動執行磁片相關工作,例如建立磁片區或將磁片轉換成動態磁碟。 如果您正使用自動安裝或 Sysprep 工具 (這不支援建立非開機磁碟區的磁碟區) 來部署 Windows,那麼以指令執行這些工作非常有用。

若要建立 diskpart 腳本,請建立一個文字檔,其中包含您想要執行的 Diskpart 命令,每行一個命令,而不是空白行。 您可以從開始一行, rem 讓這一行成為批註。 例如,以下腳本會抹除磁片,然後為 Windows 修復環境建立 300 MB 磁碟分割:

```
select disk 0
clean
convert gpt
create partition primary size=300
format quick fs=ntfs label=Windows RE tools
assign letter=T
```

範例

  • 若要執行 diskpart 腳本,請在命令提示字元中輸入下列命令,其中scriptname是包含腳本的文字檔名稱:

    diskpart /s scriptname.txt
    
  • 若要將 diskpart 的腳本輸出重新導向至檔案,請輸入下列命令,其中logfile是 diskpart 寫入其輸出的文字檔名稱:

    diskpart /s scriptname.txt > logfile.txt

SSHFS - 在 Windows 10 底下透過 SSH 將遠端目錄掛載為磁碟

2020年6月15日 星期一

Github專案: https://github.com/billziss-gh/sshfs-win

安裝步驟:
  1. WinFsp
  2. SSHFS-Win
基本用法:
net use {磁碟代號:}  \\sshfs\REMOTE_USER@HOST[\PATH]

範例:
net use  X:  \\sshfs\username@myhost.local
net use  X:  \\sshfs\username@myhost.local\..\..\var\www\html

注意:使用者帳號一定要加上,不然會無法登入 

[Windows] 設定系統分頁檔

2018年8月13日 星期一

顯示目前分頁檔設定

wmic pagefile
wmic pagefile list /format:list 

設定固定分頁檔大小

wmic computersystem where name="%computername%" set AutomaticManagedPagefile=False
wmic pagefileset where name="C:\\pagefile.sys" set InitialSize=2048,MaximumSize=2048

設定分頁檔後,檢查的方式

wmic pagefileset 
wmic pagefileset list /format:list

[批次檔] for 迴圈的變數利用方式

2018年1月27日 星期六

在 Windows 寫批次檔,利用  for 指令跑迴圈取得檔案資訊時,可以使用的修飾元

%~I         - expands %I removing any surrounding quotes (")
%~fI        - expands %I to a fully qualified path name
%~dI        - expands %I to a drive letter only
%~pI        - expands %I to a path only
%~nI        - expands %I to a file name only
%~xI        - expands %I to a file extension only
%~sI        - expanded path contains short names only
%~aI        - expands %I to file attributes of file
%~tI        - expands %I to date/time of file
%~zI        - expands %I to size of file
%~$PATH:I   - searches the directories listed in the PATH
               environment variable and expands %I to the
               fully qualified name of the first one found.
               If the environment variable name is not
               defined or the file is not found by the
               search, then this modifier expands to the
               empty string

%~dpI       - expands %I to a drive letter and path only
%~nxI       - expands %I to a file name and extension only
%~fsI       - expands %I to a full path name with short names only
%~dp$PATH:I - searches the directories listed in the PATH
               environment variable for %I and expands to the
               drive letter and path of the first one found.
%~ftzaI     - expands %I to a DIR like output line

[系統] 是 Windows 太保守?還是 Linux 太前衛?

2017年9月4日 星期一

不曉得從什麼時候開始, Windows 7(10) 更新時常常會出現失敗,而更新失敗又會導致不斷重新開機更新,得循環 2、3次才會進入 Windows 桌面,好一陣子還被同事埋怨,怎麼拿這麼舊的機器給她,開機都得等個二、三十分鐘,我了個去~~~這鍋背得…好冤啊!

Windows 只認得兩種檔案系統:FAT(32)和NTFS,別的一概不管,在系統碟裡若有分割區是在這兩種之外,用來當做資料碟的話,倒沒什麼關係,頂多就是資料讀不到,但是若是用來安裝系統……呵!呵!呵!那就麻煩了!

這幾年通常都是裝雙系統在電腦裡(是真的雙系統喔!Windows 和 Linux,而不是  Windows XP, Windows 7, Windows 10 的雙系統),因為 Windows 認不得其其它眾多的檔案系統,所以都是將 Linux 最後安裝並使用預設的 Grub2 開機管理員,這樣可以選擇 Linux 開機,還是 Windows 開機。

很不幸,問題來了,不曉得從什麼時候開始,Windows 更新會重新開機,然後再繼續更新,若不是由 Windows 的預設開機管理員(bcd)的話,更新會失敗,然後…再重新開機,再更新失敗…重開…失敗…這個過程會導致開機過程會拖延20~30分鐘。

是 Windows 只想守住眼前的3分1畝地?還是該怪 Linux 太過前衛到想把所有的檔案系統都統包呢?我也不知!不過,我知道若想繼續使用 Windows,這種情況會導出最後唯一的結果,就是把系統硬碟裡不是 FAT 和  NTFS  的分割區刪掉,So, Windows always win...

DOS Script to Reset Windows Update Agent

2017年1月5日 星期四

from: https://gallery.technet.microsoft.com/scriptcenter/Dos-Command-Line-Batch-to-fb07b159
  1. Stops Windows Update, BITS, Application Identity, Cryptographic Services and SMS Host Agent (SCCM client) services
  2. Cleans up AU cache folder and log file
  3. Re-registers *.dll files
  4. Removes WSUS Client registration Id
  5. Reset Winsock and WinHTTP Proxy
  6. Deletes all BITS jobs
  7. Restart services
  8. Forces AU discovery
@echo off 
cls 
 
REM ================================================================================== 
REM DESCRIPTION    : This script resets all of Windows Update Agent settings. 
REM AUTHOR         : Luca Fabbri 
REM VERSION HISTORY: 2.0 - Start 
REM ================================================================================== 
 
@echo 1. Stopping Windows Update, BITS, Application Identity, Cryptographic Services and SMS Host Agent services... 
net stop wuauserv 
net stop bits 
net stop appidsvc 
net stop cryptsvc 
net stop ccmexec 
 
@echo 2. Checking if services were stopped successfully... 
sc query wuauserv | findstr /I /C:"STOPPED" 
if %errorlevel% NEQ 0 goto END 
 
sc query bits | findstr /I /C:"STOPPED" 
if %errorlevel% NEQ 0 goto END 
 
sc query appidsvc | findstr /I /C:"STOPPED" 
if %errorlevel% NEQ 0 sc query appidsvc | findstr /I /C:"OpenService FAILED 1060" 
if %errorlevel% NEQ 0 goto END 
 
sc query cryptsvc | findstr /I /C:"STOPPED" 
if %errorlevel% NEQ 0 goto END 
 
sc query ccmexec | findstr /I /C:"STOPPED" 
if %errorlevel% NEQ 0 sc query ccmexec | findstr /I /C:"OpenService FAILED 1060" 
if %errorlevel% NEQ 0 goto END 
 
@echo 3. Deleting AU cache folder and log file...  
del /f /q "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat" 
del /f /s /q %SystemRoot%\SoftwareDistribution\*.*  
del /f /s /q %SystemRoot%\system32\catroot2\*.* 
del /f /q %SystemRoot%\WindowsUpdate.log  
 
REM @echo 3. Renaming AU cache folder and log file... 
REM del /f /q "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat" 
REM ren %SystemRoot%\SoftwareDistribution *.bak 
REM ren %SystemRoot%\system32\catroot2 *.bak 
REM ren %SystemRoot%\WindowsUpdate.log *.bak 
 
REM sc.exe sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU) 
REM sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU) 
 
@echo 4. Re-registering DLL files... 
cd /d %WinDir%\system32 
regsvr32.exe /s atl.dll 
regsvr32.exe /s urlmon.dll 
regsvr32.exe /s mshtml.dll 
regsvr32.exe /s shdocvw.dll 
regsvr32.exe /s browseui.dll 
regsvr32.exe /s jscript.dll 
regsvr32.exe /s vbscript.dll 
regsvr32.exe /s scrrun.dll 
regsvr32.exe /s msxml.dll 
regsvr32.exe /s msxml3.dll 
regsvr32.exe /s msxml6.dll 
regsvr32.exe /s actxprxy.dll 
regsvr32.exe /s softpub.dll 
regsvr32.exe /s wintrust.dll 
regsvr32.exe /s dssenh.dll 
regsvr32.exe /s rsaenh.dll 
regsvr32.exe /s gpkcsp.dll 
regsvr32.exe /s sccbase.dll 
regsvr32.exe /s slbcsp.dll 
regsvr32.exe /s cryptdlg.dll 
regsvr32.exe /s oleaut32.dll 
regsvr32.exe /s ole32.dll 
regsvr32.exe /s shell32.dll 
regsvr32.exe /s initpki.dll 
regsvr32.exe /s wuapi.dll 
regsvr32.exe /s wuaueng.dll 
regsvr32.exe /s wuaueng1.dll 
regsvr32.exe /s wucltui.dll 
regsvr32.exe /s wups.dll 
regsvr32.exe /s wups2.dll 
regsvr32.exe /s wuweb.dll 
regsvr32.exe /s qmgr.dll 
regsvr32.exe /s qmgrprxy.dll 
regsvr32.exe /s wucltux.dll 
regsvr32.exe /s muweb.dll 
regsvr32.exe /s wuwebv.dll 
 
@echo 5. Removing WSUS Client Id... 
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f 
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f 
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f 
 
@echo 6. Resetting Winsock and WinHTTP Proxy... 
netsh winsock reset 
proxycfg.exe -d 
netsh winhttp reset proxy 
 
@echo 7. Starting SMS Host Agent, Cryptographic Services, Application Identity, BITS, Windows Update services... 
net start ccmexec 
net start cryptsvc 
net start appidsvc 
net start bits 
net start wuauserv 
 
@echo 8. Deleting all BITS jobs... 
bitsadmin.exe /reset /allusers 
 
@echo 9. Forcing AU discovery... 
wuauclt /resetauthorization /detectnow 
 
:END 

How to remove Windows 7 System reserved partition

2015年8月24日 星期一



To update the copied BCD file so it will boot correctly, run the following command:
bcdedit  /store  c:\boot\bcd  /set  {bootmgr}  device  partition=C:

Update the Memory Diagnostic entry by running the following command:
bcdedit  /store  c:\boot\bcd  /set  {memdiag}  device  partition=C: