我想知道可以在 Windows 资源管理器中使用的变量的完整列表或 Windows 10 接受的相关相对路径。诸如%appdata%
、、%userprofile%
...%windir%
等变量。
在我的搜索中,大多数都指向已知文件夹ID或年长者计算机科学与技术实验室,但我不知道如何在 Windows 路径或文件资源管理器中准确应用它们,而且在我的测试中,它们中的大多数在文件资源管理器中不起作用。如果以上是正确的列表,请给我一些如何在 Windows 路径或文件资源管理器中应用它们的示例。谢谢!
答案1
如果您想要查看可用路径列表(例如%AppData%
和类似路径),只需打开命令提示符并输入set
。您将看到类似
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\<your user profile>\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
DriverData=C:\Windows\System32\Drivers\DriverData
HOMEDRIVE=C:
HOMEPATH=\Users\<your user profile>
LOCALAPPDATA=C:\Users\<your user profile>\AppData\Local
OneDrive=C:\Users\<your user profile>\OneDrive
OneDriveConsumer=C:\Users\<your user profile>\OneDrive
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PUBLIC=C:\Users\Public
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\Users\<your user profile>\AppData\Local\Temp
TMP=C:\Users\<your user profile>\AppData\Local\Temp
USERPROFILE=C:\Users\<your user profile>
windir=C:\WINDOWS
任何以 a 开头和结尾的都是带有=对的%
环境变量。Name
Value
如果类似的东西%appdata%
(或者它的相对子路径)对你不起作用,那么你可能需要在路径的其余部分\
之间放置一个,就像这样%appdata%
%appdata%\Microsoft
大多数%%
环境变量没有尾随\
,因此您必须自己添加。
答案2
摘自https://winsourcecode.blogspot.com/2019/05/listenvironmentexe-list-system-user.html
--------
System
--------
ComSpec=%SystemRoot%\system32\cmd.exe
DriverData=C:\Windows\System32\Drivers\DriverData
NUMBER_OF_PROCESSORS=4
OS=Windows_NT
Path=C:\Program Files (x86)\Windows Resource Kits\Tools\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%SYSTEMROOT%\System32\OpenSSH\;C:\Program Files\dotnet\
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.cpl
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 126 Stepping 5, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=7e05
PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules
TEMP=%SystemRoot%\TEMP
TMP=%SystemRoot%\TEMP
USERNAME=SYSTEM
windir=%SystemRoot%
--------
Volatile - These are set at logon
--------
LOGONSERVER=\\LAPTOP
USERDOMAIN=LAPTOP
USERNAME=David Candy
USERPROFILE=C:\Users\David Candy
HOMEPATH=\Users\David Candy
HOMEDRIVE=C:
APPDATA=C:\Users\David Candy\AppData\Roaming
LOCALAPPDATA=C:\Users\David Candy\AppData\Local
USERDOMAIN_ROAMINGPROFILE=LAPTOP
--------
User - These override system variables, and in the case of PATH are added to the system PATH
--------
OneDrive=C:\Users\David Candy\OneDrive
Path=C:\Users\David Candy\AppData\Local\Microsoft\WindowsApps;;C:\Users\David Candy\AppData\Local\Programs\Fiddler
TEMP=%USERPROFILE%\AppData\Local\Temp
TMP=%USERPROFILE%\AppData\Local\Temp
--------
Process - This is the combined environment from the above for the program
Variables starting with an equals sign, such as =C:=C:\Windows are internal CMD variables
CMD simulates a default directory per drive like MSDos. This is how it keeps track
--------
=C:=C:\Windows\System32
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\David Candy\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=LAPTOP
ComSpec=C:\Windows\system32\cmd.exe
DriverData=C:\Windows\System32\Drivers\DriverData
HOMEDRIVE=C:
HOMEPATH=\Users\David Candy
LOCALAPPDATA=C:\Users\David Candy\AppData\Local
LOGONSERVER=\\LAPTOP
NUMBER_OF_PROCESSORS=4
OneDrive=C:\Users\David Candy\OneDrive
OS=Windows_NT
Path=C:\Program Files (x86)\Windows Resource Kits\Tools\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\David Candy\AppData\Local\Microsoft\WindowsApps;C:\Users\David Candy\AppData\Local\Programs\Fiddler
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.cpl
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 126 Stepping 5, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=7e05
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=C:\Users\Public
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\DAVIDC~1\AppData\Local\Temp
TMP=C:\Users\DAVIDC~1\AppData\Local\Temp
USERDOMAIN=LAPTOP
USERDOMAIN_ROAMINGPROFILE=LAPTOP
USERNAME=David Candy
USERPROFILE=C:\Users\David Candy
windir=C:\Windows
--------
Dynamic - These are updated each time they are used
--------
CD
DATE
TIME
RANDOM
ERRORLEVEL
CMDEXTVERSION
CMDCMDLINE
HIGHESTNUMANODENUMBER
此命令列出 shell 文件夹。与shell:
运行对话框中的命令一起使用。
例如
shell:appsfolder
@For /f "tokens=1* delims=" %%A in ('reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions /f name /v name /s ^| findstr /c:"Name" ^| Sort') Do @Echo %%A
pause
并给出类似的输出
Name REG_SZ 3D Objects
Name REG_SZ AccountPictures
Name REG_SZ AddNewProgramsFolder
Name REG_SZ Administrative Tools
Name REG_SZ AppData
Name REG_SZ AppDataDesktop
Name REG_SZ AppDataDocuments
Name REG_SZ AppDataFavorites
Name REG_SZ AppDataProgramData
Name REG_SZ Application Shortcuts
Name REG_SZ AppMods
Name REG_SZ AppsFolder
Name REG_SZ AppUpdatesFolder
Name REG_SZ Cache
Name REG_SZ Camera Roll
Name REG_SZ CameraRollLibrary
Name REG_SZ Captures
Name REG_SZ CD Burning
Name REG_SZ ChangeRemoveProgramsFolder
Name REG_SZ Common Administrative Tools
Name REG_SZ Common AppData
Name REG_SZ Common Desktop
Name REG_SZ Common Documents
Name REG_SZ Common Programs
Name REG_SZ Common Start Menu
Name REG_SZ Common Start Menu Places
Name REG_SZ Common Startup
Name REG_SZ Common Templates
Name REG_SZ CommonDownloads
Name REG_SZ CommonMusic
Name REG_SZ CommonPictures
Name REG_SZ CommonRingtones
Name REG_SZ CommonVideo
Name REG_SZ ConflictFolder
Name REG_SZ ConnectionsFolder
Name REG_SZ Contacts
Name REG_SZ ControlPanelFolder
Name REG_SZ Cookies
Name REG_SZ CredentialManager
Name REG_SZ CryptoKeys
Name REG_SZ CSCFolder
Name REG_SZ Desktop
Name REG_SZ Development Files
Name REG_SZ Device Metadata Store
Name REG_SZ DocumentsLibrary
Name REG_SZ Downloads
Name REG_SZ DpapiKeys
Name REG_SZ Favorites
Name REG_SZ Fonts
Name REG_SZ GameTasks
Name REG_SZ History
Name REG_SZ HomeGroupCurrentUserFolder
Name REG_SZ HomeGroupFolder
Name REG_SZ ImplicitAppShortcuts
Name REG_SZ InternetFolder
Name REG_SZ Libraries
Name REG_SZ Links
Name REG_SZ Local AppData
Name REG_SZ Local Documents
Name REG_SZ Local Downloads
Name REG_SZ Local Music
Name REG_SZ Local Pictures
Name REG_SZ Local Videos
Name REG_SZ LocalAppDataLow
Name REG_SZ LocalizedResourcesDir
Name REG_SZ MAPIFolder
Name REG_SZ MusicLibrary
Name REG_SZ My Music
Name REG_SZ My Pictures
Name REG_SZ My Video
Name REG_SZ MyComputerFolder
Name REG_SZ NetHood
Name REG_SZ NetworkPlacesFolder
Name REG_SZ OEM Links
Name REG_SZ OneDrive
Name REG_SZ OneDriveCameraRoll
Name REG_SZ OneDriveDocuments
Name REG_SZ OneDriveMusic
Name REG_SZ OneDrivePictures
Name REG_SZ Original Images
Name REG_SZ Personal
Name REG_SZ PhotoAlbums
Name REG_SZ PicturesLibrary
Name REG_SZ Playlists
Name REG_SZ PrintersFolder
Name REG_SZ PrintHood
Name REG_SZ Profile
Name REG_SZ ProgramFiles
Name REG_SZ ProgramFilesCommon
Name REG_SZ ProgramFilesCommonX64
Name REG_SZ ProgramFilesCommonX86
Name REG_SZ ProgramFilesX64
Name REG_SZ ProgramFilesX86
Name REG_SZ Programs
Name REG_SZ Public
Name REG_SZ PublicAccountPictures
Name REG_SZ PublicGameTasks
Name REG_SZ PublicLibraries
Name REG_SZ Quick Launch
Name REG_SZ Recent
Name REG_SZ Recorded Calls
Name REG_SZ RecordedTVLibrary
Name REG_SZ RecycleBinFolder
Name REG_SZ ResourceDir
Name REG_SZ Retail Demo
Name REG_SZ Ringtones
Name REG_SZ Roamed Tile Images
Name REG_SZ Roaming Tiles
Name REG_SZ SavedGames
Name REG_SZ SavedPictures
Name REG_SZ SavedPicturesLibrary
Name REG_SZ Screenshots
Name REG_SZ Searches
Name REG_SZ SearchHistoryFolder
Name REG_SZ SearchHomeFolder
Name REG_SZ SearchTemplatesFolder
Name REG_SZ SendTo
Name REG_SZ Start Menu
Name REG_SZ Startup
Name REG_SZ SyncCenterFolder
Name REG_SZ SyncResultsFolder
Name REG_SZ SyncSetupFolder
Name REG_SZ System
Name REG_SZ SystemCertificates
Name REG_SZ SystemX86
Name REG_SZ Templates
Name REG_SZ ThisDeviceFolder
Name REG_SZ ThisPCDesktopFolder
Name REG_SZ User Pinned
Name REG_SZ UserProfiles
Name REG_SZ UserProgramFiles
Name REG_SZ UserProgramFilesCommon
Name REG_SZ UsersFilesFolder
Name REG_SZ UsersLibrariesFolder
Name REG_SZ VideosLibrary
Name REG_SZ Windows
最后列出协议处理程序。这是 UWP 应用的启动方式。还有新的控制面板小程序。
例如
calculator://
@For /f "tokens=1* delims=" %%A in ('reg query HKCR /f "URL:*" /s /d ^| findstr /c:"URL:" ^| findstr /v /c:"URL: " ^| Sort') Do @Echo %%A %%B
pause
输出是
(Default) REG_SZ URL:armodelviewing
(Default) REG_SZ URL:Available Networks Protocol
(Default) REG_SZ URL:bingweather
(Default) REG_SZ URL:calculator
(Default) REG_SZ URL:com.gotrust.cdfapp
(Default) REG_SZ URL:com.microsoft.3dviewer
(Default) REG_SZ URL:Devices Flow Connectable Devices Protocol
(Default) REG_SZ URL:Devices Flow Display Topology Protocol
(Default) REG_SZ URL:dlna-playsingle Protocol
(Default) REG_SZ URL:dropbox-oem
(Default) REG_SZ URL:evernote
(Default) REG_SZ URL:fb-events-share
(Default) REG_SZ URL:fb-messenger
(Default) REG_SZ URL:fb-messenger-api
(Default) REG_SZ URL:fb-messenger-api20131028
(Default) REG_SZ URL:fb-messenger-api20140131
(Default) REG_SZ URL:fb-messenger-api20140301
(Default) REG_SZ URL:fb-messenger-api20140430
(Default) REG_SZ URL:fb-messenger-diode
(Default) REG_SZ URL:fb-messenger-group-thread
(Default) REG_SZ URL:fb-messenger-neue
(Default) REG_SZ URL:fb-messenger-platform
(Default) REG_SZ URL:fb-messenger-platform-20150128
(Default) REG_SZ URL:fb-messenger-platform-20150218
(Default) REG_SZ URL:fb-messenger-platform-20150305
(Default) REG_SZ URL:fb-messenger-platform-20150714
(Default) REG_SZ URL:fb-messenger-public
(Default) REG_SZ URL:fb-messenger-share
(Default) REG_SZ URL:fb-messenger-share-api
(Default) REG_SZ URL:fb-messenger-voip
(Default) REG_SZ URL:fb-page-messages
(Default) REG_SZ URL:fbmessenger
(Default) REG_SZ URL:feedback-hub
(Default) REG_SZ URL:fiddlerapp
(Default) REG_SZ URL:File Protocol
(Default) REG_SZ URL:File Transfer Protocol
(Default) REG_SZ URL:File Transfer Protocol
(Default) REG_SZ URL:http
(Default) REG_SZ URL:https
(Default) REG_SZ URL:HyperText Transfer Protocol
(Default) REG_SZ URL:HyperText Transfer Protocol with Privacy
(Default) REG_SZ URL:insiderhub
(Default) REG_SZ URL:LDAP Protocol
(Default) REG_SZ URL:LDAP Protocol
(Default) REG_SZ URL:mailto
(Default) REG_SZ URL:messenger
(Default) REG_SZ URL:microsoft-edge
(Default) REG_SZ URL:microsoft.windows.camera
(Default) REG_SZ URL:microsoft.windows.camera.picker
(Default) REG_SZ URL:microsoft.windows.photos.crop
(Default) REG_SZ URL:microsoft.windows.photos.picker
(Default) REG_SZ URL:microsoft.windows.photos.videoedit
(Default) REG_SZ URL:microsoftmusic
(Default) REG_SZ URL:microsoftvideo
(Default) REG_SZ URL:MK Protocol
(Default) REG_SZ URL:mms Protocol
(Default) REG_SZ URL:mms Protocol
(Default) REG_SZ URL:ms-aad-brokerplugin
(Default) REG_SZ URL:ms-actioncenter
(Default) REG_SZ URL:ms-appinstaller
(Default) REG_SZ URL:ms-apprep
(Default) REG_SZ URL:ms-calculator
(Default) REG_SZ URL:ms-clock
(Default) REG_SZ URL:ms-contact-support
(Default) REG_SZ URL:ms-cortana2
(Default) REG_SZ URL:ms-cxh
(Default) REG_SZ URL:ms-default-location
(Default) REG_SZ URL:ms-device-enrollment
(Default) REG_SZ URL:ms-drive-to
(Default) REG_SZ URL:ms-eyecontrolspeech
(Default) REG_SZ URL:ms-gamebarservices
(Default) REG_SZ URL:ms-gamingoverlay
(Default) REG_SZ URL:ms-get-started
(Default) REG_SZ URL:ms-getoffice
(Default) REG_SZ URL:ms-holographicfirstrun
(Default) REG_SZ URL:ms-inputapp
(Default) REG_SZ URL:ms-insights
(Default) REG_SZ URL:ms-ipmessaging
(Default) REG_SZ URL:ms-meetnowflyout
(Default) REG_SZ URL:ms-msdt
(Default) REG_SZ URL:ms-officeapp
(Default) REG_SZ URL:ms-officecmd
(Default) REG_SZ URL:ms-oobenetwork
(Default) REG_SZ URL:ms-paint
(Default) REG_SZ URL:ms-penworkspace
(Default) REG_SZ URL:ms-people
(Default) REG_SZ URL:ms-phone
(Default) REG_SZ URL:ms-photos
(Default) REG_SZ URL:ms-print-addprinter
(Default) REG_SZ URL:ms-print-printjobs
(Default) REG_SZ URL:ms-quick-assist
(Default) REG_SZ URL:ms-retaildemo-launchbioenrollment
(Default) REG_SZ URL:ms-retaildemo-launchstart
(Default) REG_SZ URL:ms-screenclip
(Default) REG_SZ URL:ms-screensketch
(Default) REG_SZ URL:ms-search
(Default) REG_SZ URL:ms-settings
(Default) REG_SZ URL:ms-settings-airplanemode
(Default) REG_SZ URL:ms-settings-bluetooth
(Default) REG_SZ URL:ms-settings-cellular
(Default) REG_SZ URL:ms-settings-emailandaccounts
(Default) REG_SZ URL:ms-settings-language
(Default) REG_SZ URL:ms-settings-location
(Default) REG_SZ URL:ms-settings-lock
(Default) REG_SZ URL:ms-settings-mobilehotspot
(Default) REG_SZ URL:ms-settings-notifications
(Default) REG_SZ URL:ms-settings-power
(Default) REG_SZ URL:ms-settings-privacy
(Default) REG_SZ URL:ms-settings-proximity
(Default) REG_SZ URL:ms-settings-screenrotation
(Default) REG_SZ URL:ms-settings-wifi
(Default) REG_SZ URL:ms-settings-workplace
(Default) REG_SZ URL:ms-sttoverlay
(Default) REG_SZ URL:ms-taskswitcher
(Default) REG_SZ URL:ms-unistore-email
(Default) REG_SZ URL:ms-voip-call
(Default) REG_SZ URL:ms-voip-video
(Default) REG_SZ URL:ms-walk-to
(Default) REG_SZ URL:ms-wcrv
(Default) REG_SZ URL:ms-windows-search
(Default) REG_SZ URL:ms-windows-store
(Default) REG_SZ URL:ms-windows-store2
(Default) REG_SZ URL:ms-wpc
(Default) REG_SZ URL:ms-wpdrmv
(Default) REG_SZ URL:ms-xgpueject
(Default) REG_SZ URL:msnweather
(Default) REG_SZ URL:om.facebook.317180b0bb486
(Default) REG_SZ URL:onenote
(Default) REG_SZ URL:onenote-cmd
(Default) REG_SZ URL:outlookaccounts
(Default) REG_SZ URL:outlookcal
(Default) REG_SZ URL:outlookmail
(Default) REG_SZ URL:Play Single DLNA Item Protocol
(Default) REG_SZ URL:pw.gregoauth2
(Default) REG_SZ URL:read
(Default) REG_SZ URL:RES Protocol
(Default) REG_SZ URL:RLogin Protocol
(Default) REG_SZ URL:rsgcribbagedeluxe
(Default) REG_SZ URL:rsgheartsdeluxe
(Default) REG_SZ URL:rsgsimplemahjong
(Default) REG_SZ URL:rsgsimplesolitaire
(Default) REG_SZ URL:rsgsimplespider
(Default) REG_SZ URL:rtkuwp
(Default) REG_SZ URL:skype
(Default) REG_SZ URL:skypewin
(Default) REG_SZ URL:spotify
(Default) REG_SZ URL:tbauth
(Default) REG_SZ URL:tel
(Default) REG_SZ URL:Telnet Protocol
(Default) REG_SZ URL:TN3270 Protocol
(Default) REG_SZ URL:Virtual Touchpad
(Default) REG_SZ URL:vscode
(Default) REG_SZ URL:windows-feedback
(Default) REG_SZ URL:windows.tbauth
(Default) REG_SZ URL:windowsdefender
(Default) REG_SZ URL:xbls
(Default) REG_SZ URL:xbox
(Default) REG_SZ URL:xbox-arena
(Default) REG_SZ URL:xbox-captures
(Default) REG_SZ URL:xbox-friendfinder
(Default) REG_SZ URL:xbox-gamehub
(Default) REG_SZ URL:xbox-lfg
(Default) REG_SZ URL:xbox-network
(Default) REG_SZ URL:xbox-profile
(Default) REG_SZ URL:xbox-settings
(Default) REG_SZ URL:xbox-store
(Default) REG_SZ URL:xbox-tcui
(Default) REG_SZ URL:xboxgames
(Default) REG_SZ URL:xboxliveapp-1297287741
(Default) REG_SZ URL:xboxmusic
(Default) REG_SZ URL:zune
答案3
答案4
@mokubai 和 @ramhound 的两个答案都很有用,基本上它们是相同的,只是一个使用命令提示符,另一个使用 PowerShell。
我只是想添加一个列表默认Windows 10 的环境变量,以便其他人可以有更多资源来学习。这个答案受到他们两个答案的启发,所以向他们致敬。
https://pureinfotech.com/list-environment-variables-windows-10/
注意:其中一些仅在命令提示符下有效。