JakubM
JakubM

Reputation: 23

Define exe output folder path

I have .exe file which generate .csv file in the same location as .exe file. when I run my vb.net code .csv file is not generate in .exe file location but in location where my compiled vb.net exe code is runned.

how can I define .exe output csv file folder path? I use this code in vb.net

    Dim psi As New ProcessStartInfo
    psi.FileName = "E:\Downlaoder.exe"
    psi.Verb = "runas"
    Process.Start(psi).WaitForExit()

Upvotes: 1

Views: 156

Answers (2)

Steve
Steve

Reputation: 216303

If your program doesn't change the startup directory by itself then you should specify the WorkingDirectory when you define the ProcessStartInfo instance

Dim psi As New ProcessStartInfo
psi.FileName = "E:\Downlaoder.exe"
psi.WorkingDirectory = "E:\"  ' This if you want the file to be created in E root.

Upvotes: 1

Zedios
Zedios

Reputation: 1

You could use Directory.GetCurrentDirectory and use it as the path to save the file to the exe directory

Upvotes: 0

Related Questions