Hi, i'm brand new to VBScript but I need to use it to choose a file from the windows file browser and pass the entire path of the file as a parameter to a bat file that i call. So far I have the option to pick a file, and the option to pass parameters to the bat file. I, however, can't get the value of the parameter to be passed to the bat file instead of "parameter" itself. Also, even if I do get it to be passed, I don't think it would include the entire path where the file is located. If you could help with this, that'd be great. Here is what I have:
Option Explicit
Dim ObjFSO, InitFSO
Set ObjFSO = CreateObject("UserAccounts.CommonDialog")
ObjFSO.Filter = "|All Files|*.*"
ObjFSO.FilterIndex = 5
ObjFSO.InitialDir = "..\"
InitFSO = ObjFSO.ShowOpen
If InitFSO = False Then
Wscript.Echo "Script Error: Please select a file!"
Wscript.Quit
Else
WScript.Echo "You selected the file: " & ObjFSO.FileName
Const NORMAL_WINDOW = 1
Dim oShell, sParams
sParams = "ObjFSO.FileName"
Set oShell = CreateObject("Shell.Application")
oShell.ShellExecute "..\load\fmco\ofp\patch_constants\patch_constants.bat", sParams, , , NORMAL_WINDOW
Set oShell = Nothing
End If
Option Explicit
Dim ObjFSO, InitFSO
Set ObjFSO = CreateObject("UserAccounts.CommonDialog")
ObjFSO.Filter = "|All Files|*.*"
ObjFSO.FilterIndex = 5
ObjFSO.InitialDir = "..\"
InitFSO = ObjFSO.ShowOpen
If InitFSO = False Then
Wscript.Echo "Script Error: Please select a file!"
Wscript.Quit
Else
WScript.Echo "You selected the file: " & ObjFSO.FileName
Const NORMAL_WINDOW = 1
Dim oShell, sParams
sParams = "ObjFSO.FileName"
Set oShell = CreateObject("Shell.Application")
oShell.ShellExecute "..\load\fmco\ofp\patch_constants\patch_constants.bat", sParams, , , NORMAL_WINDOW
Set oShell = Nothing
End If