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

Run EXE File via Shell command + Arguments

Hi there,

I want to upload some exported reports to a FTP Server, for this I
use a command line FTP utility.
My Database sits in C:\Documents and Settings\Dennis\My
Documents\Database
The FTP utility sits in C:\Documents and Settings\Dennis\My
Documents\Database\oexport
The files to be uploaded in C:\Documents and Settings\Dennis\My
Documents\Database\oexport\files

Pretty organized structure.

Now my command looks like this:
Shell CurrentProject.Path & "\oexport\ncftp.exe -u myuser -p mypasswor
my.ftp.server.com /test files/*", vbNormalFocus

The command would be correct like that (when running it of the command
prompt), BUT!!!!

Access somehow sets the wrong WORKING DIR for the Exe File (does the
same for Batch files). Access runs the File in "C:\Documents and
Settings\Dennis\My Documents" instead of all the nested folders.
That happens to every EXE file I run and to every batch file too.

What I tried now is to use this command
Shell CurrentProject.Path & "\oexport\ncftp.exe -u myuser -p
mypassword my.ftp.server.com /test " & CurrentProject.Path &
"oexport/files/*", vbNormalFocus

This could work IF my program would understand those Windows long path
(it only understands Paths with 8:3 DOS naming standards).
SO what I need from you is either
- how to set the actual WORKING DIR in Access
or
- how to tell Access to use 8:3 naming for CurrentProject.Path
Dennis

PS: and yeah I need to use relative paths since the database sits in
different places, depending on the computer on which it is used.
Nov 13 '05 #1
1 15951
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You don't need the 8.3 naming convention, you need to put double-quotes
around the paths. E.g.:

const Q = """" ' double-quote
dim strCmd as string ' the command line to Shell()

strCmd = Q & CurrentProject.Path & "\oexport\ncftp.exe" & Q
strCmd = strCmd & " -u myuser -p mypassword my.ftp.server.com /test "
strCmd = strCmd & Q & CurrentProject.Path & "\oexport\files\*" & Q

Shell strCmd, vbNormalFocus

Notice I changed the destination "oexport/files/*" to use the DOS
file/directory separator "\", since CurrentProject.Path will use that
symbol. Also, I added a "\" before the destination's "oexport"
directory name.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQQqOroechKqOuFEgEQLdfgCgh4ekFppu/oRrlMmBK4ksUyUtwvgAoPAa
IuT7vZ1sSi9s4gCMRkeJzUWG
=xPrH
-----END PGP SIGNATURE-----
Dennis Gaida wrote:
Hi there,

I want to upload some exported reports to a FTP Server, for this I
use a command line FTP utility.
My Database sits in C:\Documents and Settings\Dennis\My
Documents\Database
The FTP utility sits in C:\Documents and Settings\Dennis\My
Documents\Database\oexport
The files to be uploaded in C:\Documents and Settings\Dennis\My
Documents\Database\oexport\files

Pretty organized structure.

Now my command looks like this:
Shell CurrentProject.Path & "\oexport\ncftp.exe -u myuser -p mypasswor
my.ftp.server.com /test files/*", vbNormalFocus

The command would be correct like that (when running it of the command
prompt), BUT!!!!

Access somehow sets the wrong WORKING DIR for the Exe File (does the
same for Batch files). Access runs the File in "C:\Documents and
Settings\Dennis\My Documents" instead of all the nested folders.
That happens to every EXE file I run and to every batch file too.

What I tried now is to use this command
Shell CurrentProject.Path & "\oexport\ncftp.exe -u myuser -p
mypassword my.ftp.server.com /test " & CurrentProject.Path &
"oexport/files/*", vbNormalFocus

This could work IF my program would understand those Windows long path
(it only understands Paths with 8:3 DOS naming standards).
SO what I need from you is either
- how to set the actual WORKING DIR in Access
or
- how to tell Access to use 8:3 naming for CurrentProject.Path
Dennis

PS: and yeah I need to use relative paths since the database sits in
different places, depending on the computer on which it is used.


Nov 13 '05 #2

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

Similar topics

6
by: Lauren Wilson | last post by:
Hi folks, In an A2K app, I have attempted to use the following command in some VBA code with IDENTICAL results with every single version of the following: Shell "outlook.exe", vbHide Shell...
1
by: VRWC | last post by:
Hello dear people, In an A2K app, I have attempted to use the following command in some VBA code with IDENTICAL results with every single version of the following: Shell "outlook.exe", vbHide...
4
by: Kevin Mansel via .NET 247 | last post by:
Ok, basically this is my problem. I'm building a console app tocall a dos program. So i'm using the Shell command to call theprogram, now depending on what happens, I want to read theoutput that...
3
by: Daz | last post by:
Hi everyone! This is my first time posting in this group, although I have been watching it for the past few months and have to say this is possibly the best group I have seen on Google so far!...
6
by: mardif | last post by:
Hi guys. I've a very big big big problem: I've in my windows computer a file named cicciobello.html, located in c:\documents and settings\username\desktop\cicciobello.html. Now, I MUST open...
4
by: Anastasios Hatzis | last post by:
I'm looking for a pattern where different client implementations can use the same commands of some fictive tool ("foo") by accessing some kind of API. Actually I have the need for such pattern for...
1
by: ohaqqi | last post by:
Hi guys, I'm still working on my shell. I'm trying to implement a function typefile that will take a command line input as follows: > type <file1> This command will implement a catenation of...
5
by: inetquestion | last post by:
I am looking for a web interface for shell commands or shell scripts. Does anyone know of any exexisting php scripts which would solve this requirement? PHP form accepts input from a user, then...
7
by: Samuel A. Falvo II | last post by:
I have a shell script script.sh that launches a Java process in the background using the &-operator, like so: #!/bin/bash java ... arguments here ... & In my Python code, I want to invoke...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.