大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
调用c:\1.bat,可以这样:
按需策划设计可以根据自己的需求进行定制,成都做网站、网站制作构思过程中功能建设理应排到主要部位公司成都做网站、网站制作的运用实际效果公司网站制作网站建立与制做的实际意义
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Shell("cmd.exe /c call c:\1.bat", AppWinStyle.NormalFocus)
End Sub
我觉得应该有两种解决方法
1:把patran的安装路径添加到系统环境变量的path属性下;
2:在你的批处理里面改为如下格式,patran完整路径(如c:\MSC.software\········patran.exe)+ "-sfp patran.ses",也就是下面这种情况试下“c:\MSC.software\········patran.exe -sfp patran.ses -b -ans yes”
在 Form_Load 写入
Dim cmd As String = Command()
cmd 就是传入的参数了。
就看你怎么利用了。
Imports System.IO
Imports System.Diagnostics
Imports System.Windows.Forms
Class Form1
Inherits Form
Private filename As String = "abc.bat"
Private bat As String = "@echo off" vbCr vbLf "dir" vbCr vbLf "pause" vbCr vbLf "exit" vbCr vbLf
Private Sub New()
Dim btn As New Button()
btn.Parent = Me
btn.Text = "Run bat"
AddHandler btn.Click, Sub() Process.Start(filename)
End Sub
Protected Overrides Sub OnLoad(e As EventArgs)
File.WriteAllText(filename, bat)
MyBase.OnLoad(e)
End Sub
Protected Overrides Sub OnClosed(e As EventArgs)
File.Delete(filename)
MyBase.OnClosed(e)
End Sub
STAThread _
Public Shared Sub Main()
Application.Run(New Form1())
End Sub
End Class