473,385 Members | 1,465 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,385 software developers and data experts.

how to define working directory of external program when starting it.

I have the following problem:
a program, located on drive a known drive (for example lets say drive C:) needs to execute a program on an unknown different drive (a USB device which doesn't have the same drive letter in each PC).
Locating this program isn't the problem, I'm just letting my main application check the root directory's of all drives currently in use (i know the name and that it's in the root directory).
but now comes the problem, the 'program' (which is a cmd file) needs to write something to the directory it's in, but when writing to './' it will write to the execution directory of my main program. when using the "cd\" command i can let it write to the root but than it's still the wrong drive.
As far as i know it's impossible to get the current drive letter from a .cmd file so the only solution is starting the .cmd file as if it was executed from the directory it's in.
(like the 'Start in' field when defining the properties of a shortcut)

I am currently using Dev C++, the .cmd file has to be executed hidden because the main program is a background worker and i don't want an ugly black screen flashing by. (currently using the SW_HIDE parameter to do this when creating a thread)

OS is windows xp
if you need any more info just post it.

thanks in advance
Aug 29 '07 #1
1 1897
Never mind, already found out that it is possible to specify the current dir when using the CreateProcess API while maintaining the hidden atribute if you change startup info of the process,
Aug 30 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: haynesc | last post by:
Hi, I'm having a problem where when trying to open a file in write mode, I get an IOError stating no such file or directory. I'm calling an external program which takes an input file and...
2
by: wylbur37 | last post by:
I normally use Mozilla 1.4 on Windows XP Pro. As I was developing some test webpages, I discovered that the SRC parameter doesn't seem to work when a path is used with the filename. In one...
0
by: Ana | last post by:
Hi! I have problems with the following scenario: My application is developed using C# under .NET. It must run on all Windows versions starting from Windows 98. The user must open different...
6
by: Ana | last post by:
Hi! I have problems with the following scenario: My application is developed using C# under .NET. It must run on all Windows versions starting from Windows 98. The user must open different...
4
by: My SQL | last post by:
Hi Can I trigger an external program to run when a new record is added to the mysql table? The external program is in C and instead of scanning the table continuously for new insertions, it...
4
by: qbproger | last post by:
I'm developing a plugin for some software. The previous version of the software didn't require a start in directory to be set. This allowed me to leave the working directory to the default in the...
2
by: tshad | last post by:
This has been driving me crazy. I have been trying to get the error handling working on my system and can get parts of it working and others won't work at all. I found that you can't access...
27
by: kvnsmnsn | last post by:
I've written a piece of code that interfaces with Postgres. It needs to write a Postgres table to disk, which it does with the <COPYcom- mand. That command requires the absolute file name of the...
27
by: bue | last post by:
I have PHP 5.3, PostgreSQL 8.2 and Apache 2.2 on my computer, and some MySQL. From PHP I can connect to MySQL, but not to PostgreSQL. Both drivers are uncommented in php.ini, but phpinfo() shows...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.