Is there some OS option that determines use/non-use of quotes when shelling out?
I have a job class that includes two parameters Shell_Command (the path of .exe) and Shell_Parameters...
On my machine, the following scenario works:
Shell_Command = C:\Windows\system32\rundll32.exe
Shell_Parameters = user32.dll,LockWorkStation
but not this:
Shell_Command = "C:\Windows\system32\rundll32.exe" (with quotes)
Shell_Parameters = user32.dll,LockWorkStation
(Error: Command `""C:\Windows\system32\rundll32.exe"" user32.dll,LockWorkStation` returned 'File not found.')
On another machine, the opposite is true.
What might cause this behavior?
(Unfortunately, VB.NET is not available on the other machine to debug.)
I have a job class that includes two parameters Shell_Command (the path of .exe) and Shell_Parameters...
Code:
Public Class clsJob
Public Sub sub_Run_Job_Now()
Dim strCommand As String = RTrim("""" & Me.Shell_Command & """ " & Me.Shell_Parameters)
Try
sub_Kick_Off_Job(strCommand)
Catch ex As Exception
Throw New Exception("Command `" & strCommand & "` returned '" & ex.Message & "'")
End Try
' add history information...
End Sub
Private Sub sub_Kick_Off_Job(ByVal strCommand As String)
Try
Shell(strCommand, AppWinStyle.NormalFocus, False, 5000)
Catch ex As Exception
Throw New Exception(Err.Description)
End Try
End Sub
End Class
On my machine, the following scenario works:
Shell_Command = C:\Windows\system32\rundll32.exe
Shell_Parameters = user32.dll,LockWorkStation
but not this:
Shell_Command = "C:\Windows\system32\rundll32.exe" (with quotes)
Shell_Parameters = user32.dll,LockWorkStation
(Error: Command `""C:\Windows\system32\rundll32.exe"" user32.dll,LockWorkStation` returned 'File not found.')
On another machine, the opposite is true.
What might cause this behavior?
(Unfortunately, VB.NET is not available on the other machine to debug.)