我試圖從一個VBS到BAT傳遞一個變量,但我得到「系統找不到指定文件」傳遞參數變量爲.bat
這裏是我的vbs:
Option Explicit
Dim strFile
strFile = SelectFile()
If strFile = "" Then
WScript.Echo "No file selected."
Else
WScript.Echo """" & strFile & """"
End If
Function SelectFile()
Dim objExec, strMSHTA, wshShell
SelectFile = ""
strMSHTA = "mshta.exe ""about:" & "<" & "input type=file id=FILE>" _
& "<" & "script>FILE.click();new ActiveXObject('Scripting.FileSystemObject')" _
& ".GetStandardStream(1).WriteLine(FILE.value);close();resizeTo(0,0);" & "<" & "/script>"""
Set wshShell = CreateObject("WScript.Shell")
Set objExec = wshShell.Exec(strMSHTA)
SelectFile = objExec.StdOut.ReadLine()
Dim wshShelll
Set WshShelll = Wscript.CreateObject("WScript.Shell")
WshShelll.Run "C:\Users\nbendjelida\Desktop\email.bat" & SelectFile
Set objExec = Nothing
Set wshShell = Nothing
Set wshShelll = Nothing
End Function
這裏是我的蝙蝠:
"C:\Program Files\Microsoft Office\Office12\Outlook.exe" /eml %1
你有什麼想法?
在'WshShelll.Run「的結尾用空格試試C:\ Users \ nbendjelida \ Desktop \ email.bat「' – SachaDee
驚人的,那工作:)我一直堅持2天!謝謝 :) – Nazim