includer-test
30-05-2013, 14:14
Всем доброго врмени суток. Небольшой вопрос по VBS.
Есть у меня функция, которая сохраняет файл в папке temp:
Function SaveFile(what)
Set fso = CreateObject("Scripting.FileSystemObject")
tempFolder = fso.GetSpecialFolder(2)
'tempFolder = "C:\users\%userprofile%\" не работает
filepath = tempFolder+"\weather.xml"
Dim fso1, tf
Set fso1 = CreateObject("Scripting.FileSystemObject")
Set tf = fso1.CreateTextFile(filepath, True, True) 'rewrite, unicode
tf.Write(what)
tf.Close
End Function
Насколько я понимаю у fso.GetSpecialFolder есть следующие параметры:
WindowsFolder - 0 -The Windows folder contains files installed by the Windows operating system.
SystemFolder - 1 - The System folder contains libraries, fonts, and device drivers.
TemporaryFolder - 2 - The Temp folder is used to store temporary files. Its path is found in the TMP environment variable.
Думаю понятно какие папки.
Дико извиняюсь за вопрос, но с VBS я слабо знаком.
Каким образом можно сохранить файл в папку %userprofile% ?
Есть у меня функция, которая сохраняет файл в папке temp:
Function SaveFile(what)
Set fso = CreateObject("Scripting.FileSystemObject")
tempFolder = fso.GetSpecialFolder(2)
'tempFolder = "C:\users\%userprofile%\" не работает
filepath = tempFolder+"\weather.xml"
Dim fso1, tf
Set fso1 = CreateObject("Scripting.FileSystemObject")
Set tf = fso1.CreateTextFile(filepath, True, True) 'rewrite, unicode
tf.Write(what)
tf.Close
End Function
Насколько я понимаю у fso.GetSpecialFolder есть следующие параметры:
WindowsFolder - 0 -The Windows folder contains files installed by the Windows operating system.
SystemFolder - 1 - The System folder contains libraries, fonts, and device drivers.
TemporaryFolder - 2 - The Temp folder is used to store temporary files. Its path is found in the TMP environment variable.
Думаю понятно какие папки.
Дико извиняюсь за вопрос, но с VBS я слабо знаком.
Каким образом можно сохранить файл в папку %userprofile% ?