-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotepad_fix_patch.bat
More file actions
57 lines (47 loc) · 1.78 KB
/
Copy pathNotepad_fix_patch.bat
File metadata and controls
57 lines (47 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@echo off
title Fix "New Text Document" & "Open with Notepad"
echo This script restores missing context menu entries on custom Windows builds.
echo It will:
echo - Associate .txt with Notepad
echo - Restore the "New -> Text Document" menu
echo - Add "Open with Notepad" for any file type
echo.
echo Requires Administrator privileges.
pause
:: Elevate to admin
net session >nul 2>&1
if %errorlevel% neq 0 (
echo Requesting administrator privileges...
powershell -Command "Start-Process '%~f0' -Verb RunAs"
exit /b
)
:: Locate Notepad
set "notepadPath=C:\Windows\System32\notepad.exe"
if not exist "%notepadPath%" (
echo ERROR: Notepad not found at "%notepadPath%"
echo Please install Notepad via Optional Features or update the script with the correct path.
pause
exit /b
)
echo Found Notepad at: %notepadPath%
:: Registry fixes
echo [1] Setting .txt association...
reg add "HKCR\.txt" /ve /d "txtfile" /f >nul
echo [2] Adding ShellNew for "New Text Document"...
reg add "HKCR\.txt\ShellNew" /v NullFile /t REG_SZ /d "" /f >nul
echo [3] Setting display name...
reg add "HKCR\txtfile" /ve /d "Text Document" /f >nul
echo [4] Setting default icon...
reg add "HKCR\txtfile\DefaultIcon" /ve /d "%SystemRoot%\System32\imageres.dll,-102" /f >nul
echo [5] Setting Notepad as default open command...
reg add "HKCR\txtfile\shell\open\command" /ve /d "\"%notepadPath%\" \"%%1\"" /f >nul
echo [6] Adding "Open with Notepad" to all files...
reg add "HKCR\*\shell\Open with Notepad" /ve /d "Open with Notepad" /f >nul
reg add "HKCR\*\shell\Open with Notepad\command" /ve /d "\"%notepadPath%\" \"%%1\"" /f >nul
echo [7] Restarting Explorer...
taskkill /f /im explorer.exe >nul 2>&1
start explorer.exe
echo.
echo Done! Right-click on desktop or any file to see the new options.
pause
exit /b