?
Solved

Shell Command in vb.net

Posted on 2006-10-29
3
Medium Priority
?
13,028 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 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 70

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

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses

762 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