我有一个保存在 "test.vbs" 中的脚本:
Set FSO = CreateObject("Scripting.FileSystemObject")
Set File = FSO.OpenTextFile(workFolder &"\test.txt", 2, True)
File.Write "testing"
File.Close
Set File = Nothing
Set FSO = Nothing
Set workFolder = Nothing
当我运行这个脚本时, 我想传递 "workFolder" 变量的值。如何做到这一点?我可以吗?类似于 "cscript test.vbs workFolder:'C:\temp\'" 这样的方式吗?
附加问题:在终止时,是否需要使用 "Set workFolder = Nothing" 清除传递的变量?或者VBScript在终止时会自动完成清理?也许 "Set File = Nothing" 和 "Set FSO = Nothing" 也是不必要的?如果您知道这两个问题的答案,请告诉我。