在批处理文件中,我正在像这样读取'ProfileImagePath'的值...
for /f "delims=" %%a in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%thisusersid%" /v ProfileImagePath') do set "thisuserprofile=%%a"
这将在变量%thisuserprofile%中填充以下内容。...
ProfileImagePath REG_EXPAND_SZ C:\Users\joebloggs
我该如何去获取价值,所以...
例如,%THISUSERPROFILE%=“ C:\ Users \ joebloggs”?
我知道用户个人资料已经有一个Windows变量,但是父脚本正在系统上下文中运行,因此我必须走很长一段路,确定用户的SID和个人资料位置等。
提前谢谢! :)
答案 0 :(得分:0)
这就是我的方法...
for /f "tokens=2*" %%a in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\%USERSID%" /v ProfileImagePath') do set "thisuserprofile=%%~b"
回显%thisuserprofile%
输出只是配置文件路径:)