VBS 从下载中移动文件

VBS move files from download

如何从 C:\Users\username\Downloads 移动文件 是否有一个用户名变量,这样如果它在其他人的计算机上,它也可以工作,并且您不需要碰碰代码。因为我无法访问用户名,所以我无法将任何文件从 downlaods 文件夹移动到其他文件夹。我查看 windows 命令,但没有答案 我在互联网上查看过,但有更多人遇到同样的问题,也没有好的答案。 2 周后我仍然不知道使用 vbs 到下载文件夹的路径。有什么建议

有,但你不应该使用它。环境变量不适用于程序。

There are a number of standard folders that are used frequently by applications, but may not have the same name or location on any given system. For example, the system folder may be "C:\Windows" on one system and "C:\Winnt" on another. The values in this enumeration are equivalent to the CSIDL values used in C++ applications. They provide a unique system-independent way for applications to identify special folders. They supersede the use of environment variables for this purpose.

https://docs.microsoft.com/en-us/windows/win32/api/shldisp/ne-shldisp-shellspecialfolderconstants

并使用

    set objShell = CreateObject("shell.application")
    set objFolder = objShell.NameSpace("C:\")

https://docs.microsoft.com/en-us/windows/win32/shell/shell-namespace