Ehaviv
Computer
- Jul 2, 2003
- 1,012
Hi
In this journal I get a blank output:
Dim outfile As String = _
"C:\haviv\_00_vita_vme_std\_m3u_assy_002" & "\ugiiOutput.txt"
? can someone help to explain this.
Thank you in advanced
In this journal I get a blank output:
Dim outfile As String = _
"C:\haviv\_00_vita_vme_std\_m3u_assy_002" & "\ugiiOutput.txt"
? can someone help to explain this.
Code:
'Start an invisible process.
'You can start a process and get its output without a visible window.
'This shows how to changes to the System folder,
'run the DOS Dir "*.exe" command and send the output to the Output.txt file.
'The Windows XP command shell interpreter recognizes "&&" as a command separator,
'thus, you can put multiple commands on a single line.
' "&&" command separator,
' ">>" redirects output into a file, append to existing
' ">" redirects output into a file, clear the existing.
' Chr(34) = "
Option Strict Off
Imports System
Imports System.Diagnostics
Imports System.Security
Imports System.Windows.Forms
Module NXJournal
Sub Main (ByVal args() As String)
Dim myProcess As Process = New Process()
Dim s As String
Dim outfile As String = _
"C:\haviv\_00_vita_vme_std\_m3u_assy_002" & "\ugiiOutput.txt"
'
' Get the System path.
'
'Dim sysFolder As String =
'System.Environment.GetFolderPath(Environment.SpecialFolder.System)
'
Dim ugiiFolder As String = "C:\Program Files\Siemens\NX 8.5\UGII"
MsgBox(" Changed to folder = " & ugiiFolder)
'
' Createe the command line.
'
myProcess.StartInfo.FileName = "cmd.exe"
myProcess.StartInfo.Arguments = "/C cd " & ugiiFolder & _
" && ug_clone -pim=Yes -o=clone:Import -Part=C:\_m3u_002\comp1.prt" & _
" > " & Chr(34) & outfile & Chr(34) & " && exit"
'
' Start the process in a hidden window.
'
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal 'Hidden
myProcess.StartInfo.CreateNoWindow = False 'True
myProcess.Start()
'
' Kill the process if it doesn't finish in one minute.
'
myProcess.WaitForExit()
'myProcess.WaitForExit(1000)
'If Not myProcess.HasExited Then
'myProcess.Kill()
'End If
'
' Show the results.
'
MessageBox.Show("The 'ug_clone ' command window was " & _
"closed at: " & myProcess.ExitTime & "." & System.Environment.NewLine & _
"Exit Code: " & myProcess.ExitCode)
myProcess.Close()
End Sub
End Module
Thank you in advanced