Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I specify a directory in ProcessStartInfo?

Posted on 2014-07-20
4
Medium Priority
?
198 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
[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
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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

670 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