如何使用 Javascript 知道计算机配置文件名称
我想获取计算机用户配置文件名称以将日志文本放在 appData
注意:这仅适用于 IE,(当前用于 Windows 7 小工具)
默认值是,没有配置文件名称是这样
C:/Users/user/AppData/Local/sampleFolder/
但是当它上面有一个个人资料名称时,它应该是什么?
C:/Users/{profileName}/AppData/Local/sampleFolder/
我的固定解决方案(但我推荐接受的答案)
function GetComputerName()
{
try
{
var network = new ActiveXObject('WScript.Network');
// Show a pop up if it works
alert(network.computerName);
}
catch (e) { }
}
I want to get the computer user profile name to put log text on the appData
note: This is just for IE, (currently using this for windows 7 gadget)
The default would be, without profile name is this
C:/Users/user/AppData/Local/sampleFolder/
but when there is a profile name on it, what should it be?
C:/Users/{profileName}/AppData/Local/sampleFolder/
My fixed solution (but I recommend the accepted answer)
function GetComputerName()
{
try
{
var network = new ActiveXObject('WScript.Network');
// Show a pop up if it works
alert(network.computerName);
}
catch (e) { }
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信这只是用户名,应该是:
此页面看起来像是您正在创建的对象的指南(以供将来参考)。
I believe that would just be the users name, which should be:
This page looks like a guide to the object you are creating (for future reference).