Function createfile(namestr)
Set fso=CreateObject("scripting.filesystemobject")
Set objfile1=fso.CreateTextFile("c:\sql.txt",True)
objfile1.WriteLine namestr
objfile1.Close
End Function
Set objargs=WScript.Arguments
If objargs.Count=0 Then
MsgBox "1"
createfile("")
Else
MsgBox "2"
createfile(objargs.Item(0))
End If
可能拖过去的,当前目录发生了改变,改成了绝对路径就行。
两句createfile 参数都一样,即使写了文件也看不出有没写过。
补充:我找着了,我这里写在了这里:C:\Documents and Settings\Administrator
function创建的函数调用时后有参数需要用call调用