Solved

How do I specify a directory in ProcessStartInfo?

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

635 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