Solved

Shell Command in vb.net

Posted on 2006-10-29
3
12,988 Views
Last Modified: 2012-05-05


I had a program which will convert the content of text file into a desired format and inorder to run this pro we need to pass in input filename paramter and keyword /p and will generate a txt in the working ditector. I have excecuted the below syntax in command prompt and the conversion works fine.

CD C:\Program Files

CD My Converter

C:\ProgramFiles\MyConverter>Converter /p c:\test2.txt

Conversion sucessful

VB.net code


        Dim stemp As String
        stemp = "cmd /c c:\Program Files\MyConverter\Converter.exe /p " + "c:\test2.txt "
        Shell(stemp)
 
But .net code does nt work..What seems to be the problem lately. Experts, pls advice.
       
0
Comment
Question by:niger007
  • 2
3 Comments
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 17831613
Hi niger007,

it might be the space in the path.

try this:
stemp = "cmd /c " + chr(34) + "c:\Program Files\MyConverter\Converter.exe" + chr(34) + " /p " + "c:\test2.txt "


Cheers!
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 17831616
niger007,

You might also want to check the Process.Start method that is more .Net-ish!
0
 

Author Comment

by:niger007
ID: 17831659
David Bro,

Awesome.... it is working now..

Niger.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now