vbs支不支持系统 的相对路径?

2024-12-28 10:33:48
推荐回答(3个)
回答1:

Set WS = CreateObject("WScript.Shell")
WScript.Echo WS.Environment("User")("temp")
WScript.Echo WS.Environment("System")("temp")
WScript.Echo WS.ExpandEnvironmentStrings("%temp%")
WScript.Echo WS.ExpandEnvironmentStrings("%APPDATA%")
WScript.Echo WS.ExpandEnvironmentStrings("%USERPROFILE%")

Dim fso
A = WS.ExpandEnvironmentStrings("%HOMEPATH%")
B = WS.ExpandEnvironmentStrings("%APPDATA%")
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile A & "\1.txt", B

回答2:

==============================代码======================================
Dim WshShell
Set WshShell = CreateObject("Wscript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Source_Path_file= "C:" & WshShell.ExpandEnvironmentStrings ("%HOMEPATH%") & "\1.txt"
Dis_Path=WshShell.ExpandEnvironmentStrings ("%APPDATA%") & "\"
fso.CopyFile Source_Path_file,Dis_Path
=============================代码结束====================================
这个才是正确的。望采纳!

回答3:

呵呵,还是有待深入学习啊,已经有人给你做出解答了