本文介绍了通过vb.net运行bat文件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好, 我正在创建并从vb.net调用批处理文件来运行java程序(bat文件中的java命令)。 bat文件创建正常......但是在运行它时,java命令前面会出现一些奇怪的符号,它阻止系统将java识别为任何类型命令。 我想知道那是什么东西!!! 这里使用的代码: 进口系统 进口 System.IO 模块 Module1 Sub Main() Dim str,s1 As String s1 = wednesday str = java pname& s1& File.Create( D:\\ \\ _ \\\ MSG \sms_old\send.bat)。Dispose() My.Computer.FileSystem.WriteAllText( D:\\\\ MSG \sms_old\send.bat,str.Trim(),错误) Dim processinfo As 新 ProcessStartInfo() processinfo.WorkingDirectory = D:\\\\ MSG \sms_old processinfo.FileName = send.bat Process.Start(processinfo) 结束 Sub 结束 模块 这应该在命令提示符下生成: D:\\\\ MSG \sms_old> java pname周三 但是它正在产生这样的东西: D:\\\\ MSG \sms_old>∩╗┐javapnamewednesday 任何人都可以点亮它吗? 非常感谢!!! 解决方案 Hi Everyone,I am creating and calling a batch file from vb.net to run a java program(java command inside bat file).The bat file is creating fine....but while running it some kind of weird sign is coming in front of the java command that is stopping system from recognizing java as any type of command.I wonder what could be that thing!!!here's code I used:Imports SystemImports System.IOModule Module1 Sub Main() Dim str, s1 As String s1 = "wednesday" str = "java pname """ & s1 & """" File.Create("D:\sa\MSG\sms_old\send.bat").Dispose() My.Computer.FileSystem.WriteAllText("D:\sa\MSG\sms_old\send.bat", str.Trim(), False) Dim processinfo As New ProcessStartInfo() processinfo.WorkingDirectory = "D:\sa\MSG\sms_old" processinfo.FileName = "send.bat" Process.Start(processinfo) End SubEnd ModuleThis should have produced this in command prompt:D:\sa\MSG\sms_old>java pname "wednesday"But it is producing something like this:D:\sa\MSG\sms_old>∩╗┐java pname "wednesday"Can anyone throw any light on it?Thanks a lot!!! 解决方案 这篇关于通过vb.net运行bat文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-28 21:43