I have tried to create a shell command to run a command line from an external application. The quoting of the command and the paths to the files it operates on as well as the redirect for the log file is proving.... well exasperating to say the least. Here is the code the VB has in it:
Shell Environ$("COMSPEC") & " /C " & Chr$(34) & "c:\Program Files\EDS\Unigraphics NX 2.0\UGII\ug_convert_part.exe" _
& Chr$(34) & " -in " & InpuDir & "\" & InputFil & " -o " & OutpuDir & " > " & Chr(34) & Chr(34) & "c:\temp\ugconvertlog.txt" & Chr(34)
This yields to the immediate screen the following:
"c:\Program Files\EDS\Unigraphics NX 2.0\UGII\ug_convert_part.exe" -in "j:\Gedkins\Tangent Edges.prt" -o C:\Temp > "c:\temp\ugconvertlog.txt"
This fails to work via VB however if I cut in paste this directly to a cmd window it runs just fine. One last issue I need to enclose the C:\temp path in quotes in case the output directory (path following the -o) has a space in its name like the in put path. The log file directory is hard coded so it won't need to change, I delete the log at the end of the program.
Any ideas why this works on copy and paste and not via the shell cmd in VB.
Guy
Shell Environ$("COMSPEC") & " /C " & Chr$(34) & "c:\Program Files\EDS\Unigraphics NX 2.0\UGII\ug_convert_part.exe" _
& Chr$(34) & " -in " & InpuDir & "\" & InputFil & " -o " & OutpuDir & " > " & Chr(34) & Chr(34) & "c:\temp\ugconvertlog.txt" & Chr(34)
This yields to the immediate screen the following:
"c:\Program Files\EDS\Unigraphics NX 2.0\UGII\ug_convert_part.exe" -in "j:\Gedkins\Tangent Edges.prt" -o C:\Temp > "c:\temp\ugconvertlog.txt"
This fails to work via VB however if I cut in paste this directly to a cmd window it runs just fine. One last issue I need to enclose the C:\temp path in quotes in case the output directory (path following the -o) has a space in its name like the in put path. The log file directory is hard coded so it won't need to change, I delete the log at the end of the program.
Any ideas why this works on copy and paste and not via the shell cmd in VB.
Guy