Solved

How do I specify a directory in ProcessStartInfo?

Posted on 2014-07-20
4
190 Views
Last Modified: 2014-07-21
I am downloading SQLExpress from my website and want it to be saved in a specific directory.  

Here is the code:

Dim p As New ProcessStartInfo
p.FileName = "http://desktophousewife.com/SQLEXPR_x64_ENU.exe"
' Start the process - Download and save file
Process.Start(p)
' save file in "C:\SQLDownload" ' or where ever you want then change the line below
MessageBox.Show("Press OK when download is complete")

I don't know how to do what is in bold.  Any help will be greatly appreciated!

Thanks.
0
Comment
Question by:Karen Wilson
  • 2
4 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 40207528
There is a WorkingDirectory property of the ProcessStartInfo but I don't know if that is what you need.  If it doesn't do what you want then I suspect it isn't possible.

http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.workingdirectory%28v=vs.110%29.aspx
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 40208581
This will open the browser which would then prompt the user to decide whether to run the file, save it to disk or to ignore it. I think I mentioned in one of the previous questions that you can use My.Computer.Network.DownloadFile method to download it silently to whichever directory you want to.

http://msdn.microsoft.com/en-us/library/ack30t8y(v=vs.90).aspx
0
 

Author Closing Comment

by:Karen Wilson
ID: 40208652
Thanks!!  Works perfectly.  Yes, you did mention it previously but I was trying to figure out the silent load of SQL.  I'm combining it with the other code for smoother sailing.  Thanks again!
0
 

Author Comment

by:Karen Wilson
ID: 40210010
Code so someone else can use it:

Imports System.IO
Imports Microsoft.VisualBasic.FileIO
Imports System.Object
Imports Microsoft.VisualBasic.Devices.Network

My.Computer.Network.DownloadFile("http://yourwebsite.com/SQLEXPR_x64_ENU.exe", "C:\yourDirectory\SQLEXPR_x64_ENU.exe", "", "", True, 500, True)
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

776 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