473,396 Members | 1,836 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Executing files from a small VB program

Im attempting to develop a small program that will act as a console for
private users.

Here they can add their favourite .exe files or whatever, with a path
and a program/game name. The program will then run whatever based on a
path.

Problem:
- When attempting this code as final to start the program
System.Diagnostics.Process.Start(), with the varibale or path inside
the clams, the files the .exe need to run are copied into the bin
folder and there is a windows error message (standard one).

My take is that the program attempts to start the program in the bin
folder instead of the folder where the .exe is located.

I've tried a number of codes ive found on the net, but they are all
incomplete, or are not meant to work in Visual Studio 7.x (usually
there are commands involved that are not present in VS, and so the tool
tells me to define them).

Any takers?

Dec 12 '05 #1
5 1480
<ke***@nordlysnett.no> schrieb:
Here they can add their favourite .exe files or whatever, with a path
and a program/game name. The program will then run whatever based on a
path.

Problem:
- When attempting this code as final to start the program
System.Diagnostics.Process.Start(), with the varibale or path inside
the clams, the files the .exe need to run are copied into the bin
folder and there is a windows error message (standard one).

My take is that the program attempts to start the program in the bin
folder instead of the folder where the .exe is located.


Are you sure you are passing the complete path of the exectable file you
want to start to 'Process.Start'?

\\\
System.Diagnostics.Process.Start("C:\bla\foo.exe") ;
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Dec 12 '05 #2
Here is two examples I hardcoded and tested just by running it alone:

Didn't work, like any other game i tried:
System.Diagnostics.Process.Start("C:\Program Files\Eidos\Hitman
Contracts\HitmanContracts.exe")

Neverwinter nights did'nt work either.

Worked:
System.Diagnostics.Process.Start("C:\Program Files\test.avi")

winrar and photoshop also worked...so im suspecting that it has
something to do with games :P ?

Dec 12 '05 #3
I would suggest looking at the shortcuts for the games in question and
make sure that you are duplicating the correct path, the correct
command line arguments and also make sure that the current directory is
set correctly. Most shortcuts have a parameter called "Start In" which
may be required by some games.

Dec 12 '05 #4
Yeah, it think its the start in value aswell thats bugging me, could
any of you give me btn_click example of how I set all these parameters?

Dec 13 '05 #5
It would be something like this using a ProcessStartInfo object:

Public Sub StartProcess()

Dim startInfo As New ProcessStartInfo("appname.exe")

startInfo.WorkingDirectory = "c:\whatever"
startInfo.Arguments = "command line arguments here"

Process.Start(startInfo)

End Sub

Dec 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Erhan | last post by:
Hello, after a recent move to windows API from terminal I come across a small problem. How can I execute a program without using stdlib.h ? Before I would use stdlib.h by using a command such as...
1
by: Xilo Musimene | last post by:
Hi there, I'm programming an archiving class and the archive is currently able to read files, concatenate them in one and compress the archive (or specific files that can be compressed) with the...
15
by: (Pete Cresswell) | last post by:
I've got a .BAT file that I use for executing various MS Access apps that I wrote way back in the days of 2.0. It's evolved over time, but it still contains a number of possible paths to...
9
by: Mads W. | last post by:
I want to read an ini file which is located in the same dir as my .exe file. But how can I do that without having to have the excact same dir for all my program installations. Let me try to...
11
by: simon | last post by:
Hello, I'm helping write a .net app, we are using VS2005 and asp/vb.net for code we are using the "masterPage.master" technique, within the masterpage we have an asp:contentplaceholder that is...
8
by: lovecreatesbea... | last post by:
K&R 2, sec 2.4 says: If the variable in question is not automatic, the initialization is done once only, conceptually before the program starts executing, ... . "Non-automatic variables are...
5
by: nic | last post by:
On my system (WinXP) typing the following line into command prompt(cmd.exe) successfully scans the file test1.txt: "c:\Program Files\Grisoft\AVG Free\avgscan.exe" "c:\program...
2
by: Jorgen Bodde | last post by:
Hi all, This is slightly OT but it drives me nuts. Whenever I create a shortcut in the start menu (in Windows) of a python script, it will only execute it when the path where the script resides...
16
by: scholz.lothar | last post by:
I want to add some extension features to my program and this would require that i bundle a small c compiler with my program. On Unix it seems that tiny-c can do this, but i don't know about windows.
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.