Windows环境变量(百分号)

Windows 系统变量

Windows 里的环境变量以及%USERPROFILE%等变量设置

%windir%.com,这两个百分号是什么意思?

系统变量 %USERPROFILE%

可以用CMD的SET命令来查看现有的系统变量,“="前的部分用%括起来就是

# 常用:
%USERPROFILE%  =C:\Users\用户名
%SystemRoot%  =C:\WINDOWS
%SystemDrive%  =C:
%APPDATA%  =C:\Users\用户名\AppData\Roaming
%LOCALAPPDATA%  =C:\Users\用户名\AppData\Local
%windir%  =C:\WINDOWS
%Path%  =C:\Windows\system32;C:\Windows; 
%ProgramData%  =C:\ProgramData
%ProgramFiles%  =C:\Program  Files
%ProgramFiles(x86)%  =C:\Program  Files  (x86)

# 其他:
%ALLUSERSPROFILE%  =C:\ProgramData
%CommonProgramFiles%  =C:\Program  Files\Common  Files
%CommonProgramFiles(x86)%  =C:\Program  Files  (x86)\Common  Files
%CommonProgramW6432%  =C:\Program  Files\Common  Files
%COMPUTERNAME%  =MyPC
%ComSpec%  =C:\WINDOWS\system32\cmd.exe
%HOMEDRIVE%  =C:
%HOMEPATH%  =\Users\用户名
%LOGONSERVER%  =\\MicrosoftAccount
%OS%  =Windows_NT
%ProgramW6432%  =C:\Program  Files   
%PUBLIC%  =C:\Users\Public 
%TEMP%  =C:\Users\用户名\AppData\Local\Temp
%TMP%  =C:\Users\用户名\AppData\Local\Temp
%USERDOMAIN%  =MyPC 
%USERNAME%  =用户名

Python 引用Windows环境变量:
How to get Desktop location?

import os
desktop = os.path.expanduser("~/Desktop")

# the above is valid on Windows (after 7) but if you want it in os normalized form:
desktop = os.path.normpath(os.path.expanduser("~/Desktop"))
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值