Solved

How do I specify a directory in ProcessStartInfo?

Posted on 2014-07-20
4
188 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

948 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

23 Experts available now in Live!

Get 1:1 Help Now