In an HTA file I have the code shown below.
It used to run in a directory other than "My Report". The old folder
name had spaces and there were no problems.
When it runs in the "My Report" directory a message appears saying
"System can not find the file specified".
The string being sent to WSH.Run is:
C:\My%20Folder\script.vbs "C:\My Report\a.txt" "C:\My Report\b.txt"
Changing the string to
C:\My%20Folder\script.vbs ""C:\My Report\a.txt"" "C:\My Report\b.txt""
and
"C:\My%20Folder\script.vbs "C:\My Report\a.txt" "C:\My Report\b.txt" "
and
"C:\My%20Folder\script.vbs ""C:\My Report\a.txt"" ""C:\My Report
\b.txt"" "
and other permutations didn't work.
What do I need to do? Thanks.
<script language="VBScript">
Function CreateReport
File1 = "C:\My Report\a.txt"
File2 = "C:\My Report\b.txt"
Set WSH = CreateObject("WScript.Shell")
WSH.Run GetPath(document.location.pathname) & "my.vbs" & _
Chr(34) & File1 & Chr(34) & " " & _
Chr(34) & File2 & Chr(34)
Window.Close
End Function
Function GetPath(Path)
ix=InstrRev(Path,"\")
Path=Left(Path,ix)
GetPath = Path
End Function
</script>