execution of a cmd file does not work
execution of a cmd file does not work
execution of a cmd file does not work
execution of a cmd file does not work
execution of a cmd file does not work
execution of a cmd file does not work execution of a cmd file does not work execution of a cmd file does not work execution of a cmd file does not work execution of a cmd file does not work execution of a cmd file does not work execution of a cmd file does not work execution of a cmd file does not work
execution of a cmd file does not work execution of a cmd file does not work
execution of a cmd file does not work
Go Back  Xtreme Visual Basic Talk > > > execution of a cmd file does not work


Reply
 
Thread Tools Display Modes
  #1  
Old 01-28-2011, 07:16 AM
manspcb manspcb is offline
Newcomer
 
Join Date: Jul 2010
Posts: 10
Unhappy execution of a cmd file does not work


Hello,

I have this commandline in a cmd file
"C:\MentorGraphics\7.9EE\SDD_HOME\common\win32\bin\asc_out.exe" "-PROJECT=D:\VeribestData\b55250u05\b55250u05.prj" "-OUT=D:\VeribestData\b55250u05\b55250u05.inp" "*(*)"
And this peace of code
Dim program As New Process()
Try
program.StartInfo.FileName = Chr(34) & PrjSets.ProjPath & "ascii.cmd" & Chr(34)
program.StartInfo.Arguments = ""
program.Start()
program.WaitForExit()
Catch ex As IOException
MessageBox.Show(ex.Message)
End Try
And it generates no output
If I double click on the command file it generates output
What am I doing wrong

Regards

Mans
Reply With Quote
  #2  
Old 01-28-2011, 09:21 AM
AtmaWeapon's Avatar
AtmaWeaponexecution of a cmd file does not work AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

Have you tried setting the WorkingDirectory property of the StartInfo to the path to the cmd file?

When you run a file from the command prompt, it uses the current directory as the "working" directory. Any relative paths or wildcards you specify will be expanded with respect to that working directory.

So if your cmd file is at C:\ascii\ascii.cmd, its working directory is C:\ascii. The program asc_out.exe will inherit this working directory (I think) and at the very least the "*(*)" parameter is likely intended to be for this directory. If your VB .NET program is executing from C:\projects\ascii\bin\debug\ascii.exe, its working directory is C:\projects\ascii\bin\debug. Since that's a different directory, your inputs to the program are different and you get different results.

If you set the WorkingDirectory property, the program will use the directory you specify.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
execution of a cmd file does not work
execution of a cmd file does not work
execution of a cmd file does not work execution of a cmd file does not work
execution of a cmd file does not work
execution of a cmd file does not work
execution of a cmd file does not work execution of a cmd file does not work execution of a cmd file does not work execution of a cmd file does not work execution of a cmd file does not work execution of a cmd file does not work execution of a cmd file does not work
execution of a cmd file does not work
execution of a cmd file does not work
 
execution of a cmd file does not work
execution of a cmd file does not work
 
-->