如何使用 WSH 脚本获取临时文件夹路径?
问问题
2885 次
2 回答
1
将此脚本另存为 tempFolder.js 并双击执行。
var WshShell = WScript.CreateObject("WScript.Shell");
var temp = WshShell.ExpandEnvironmentStrings("%TEMP%");
WScript.Echo(temp);
于 2012-09-19T04:43:17.487 回答
0
Set WshShell = CreateObject("WScript.Shell")
Set WshEnv = WshShell.Environment
strVar1="TEMP"
strVar2="TMP"
WScript.Echo ".... System ............................. Environment " & strVar1 & "," & strVar2
WScript.Echo WshShell.Environment("System").Item(strVar1)
WScript.Echo WshShell.Environment("System").Item(strVar2)
WScript.Echo ".... User ............................. Environment " & strVar1 & "," & strVar2
WScript.Echo WshShell.Environment("User").Item(strVar1)
WScript.Echo WshShell.Environment("User").Item(strVar2)
WScript.Echo ".... Volatile ............................. Environment " & strVar1 & "," & strVar2
WScript.Echo WshShell.Environment("Volatile").Item(strVar1)
WScript.Echo WshShell.Environment("Volatile").Item(strVar2)
WScript.Echo ".... Process ............................. Environment " & strVar1 & "," & strVar2
WScript.Echo WshShell.Environment("Process").Item(strVar1)
WScript.Echo WshShell.Environment("Process").Item(strVar2)
WScript.Echo ".... ............................. Environment " & strVar1 & "," & strVar2
WScript.Echo WshShell.Environment.Item(strVar1)
WScript.Echo WshShell.Environment.Item(strVar2)
WScript.Echo ".... ................ ExpandEnvironmentStrings " & strVar1 & "," & strVar2
WScript.Echo WshShell.ExpandEnvironmentStrings("%"& strVar1 &"%")
WScript.Echo WshShell.ExpandEnvironmentStrings("%"& strVar2 &"%")
于 2013-01-01T16:43:06.210 回答