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

passing long filenames as arguments to command line

I'm running a console application (ghostscript) by starting it as a process
with arguments.

The problem i'm having is that it's falling over when I pass a file
containing spaces in the filename or filepath.

Anyone know how to get around this? (i've tried putting the file in quotes,
but it doesn't seem to work e.g. -sPDFname#"filename")
Nov 21 '05 #1
2 2544
I just posted a question regarding this, albeit with an always changing
number of arguments. This is how I've been able to get all the arguments
passed correctly, when the number of arguments is always static. Just
modify the 'applaunch.StartInfo.Arguments' line to adjust the number of
arguments accordingly. Each space between arguments, or even in a
filename/path, represents an increase in arrayCount. Let me know how it
goes...
Dim applaunch As Process = New Process()
Dim arrayCount As Integer, appArgs() As String

'pull external exe path/name and args into array, then count array items
appArgs = System.Environment.GetCommandLineArgs
For arrayCount = 0 To UBound(appArgs)
Next arrayCount

applaunch.StartInfo.FileName = appArgs(1)
applaunch.StartInfo.Arguments = appArgs(2) & " " & appArgs(3) & " " &
appArgs(4)
"Colmag" <Co****@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.com...
I'm running a console application (ghostscript) by starting it as a process with arguments.

The problem i'm having is that it's falling over when I pass a file
containing spaces in the filename or filepath.

Anyone know how to get around this? (i've tried putting the file in quotes, but it doesn't seem to work e.g. -sPDFname#"filename")

Nov 21 '05 #2
I was adding the quotes in the wrong place. I was saying
-sPDFname#"filename" when I should have been saying "-sPDFname#filename"

"Colmag" wrote:
I'm running a console application (ghostscript) by starting it as a process
with arguments.

The problem i'm having is that it's falling over when I pass a file
containing spaces in the filename or filepath.

Anyone know how to get around this? (i've tried putting the file in quotes,
but it doesn't seem to work e.g. -sPDFname#"filename")

Nov 21 '05 #3

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

Similar topics

2
by: John Leslie | last post by:
I am porting a script from Korn Shell to python and want to pass named parameters like -JOB 123456 -DIR mydir I can get it to work passing --JOB and --DIR but not -JOB and -DIR Any ideas? ...
1
by: Casey Bralla | last post by:
I've got a python cgi-bin application which produces an apache web page. I want to pass arguments to it on the URL line, but the parameters are not getting passed along to python properly. I've...
4
by: Tosch | last post by:
If a user starts a second instance of my application I want to pass the specified parameters to a already running instance of the application and the terminate the second instance. I know how to...
4
by: Justine | last post by:
Can anyone help? e.g. when you open a vb project property page, in "Configuration Properties" You will see "Command line arguments" in "Start Options". Does anyone knows how to find a way to do...
6
by: NYGeekGirl | last post by:
I have two applications, one of which can launch the other using a System.Diagnostics.Process. I want to pass database connection information from one application to the other. I've resorted to...
6
by: =?iso-8859-1?q?Luis_M._Gonz=E1lez?= | last post by:
Please forgive me if what I'm asking is non sense... I created a little program to authomate the creation of the "setup.py" script for py2exe. It simply prompts for the main executable script...
6
by: virgincita schmidtmann | last post by:
Good evening, I would like to pass the size of an array from the commandline. int main(int argc, int *argv) { .... max=*argv; int list; ....
2
by: william.w.oneill | last post by:
I have an application that takes a few command line parameters. As recommended by others in this group, I'm using a named mutex to ensure that only one instance of the application is running. My...
3
by: vijayarl | last post by:
Hi all, i have perl script, which is used to send mail. its a command line utility. if we run this perl script in command line by passing all it's required arguments, it works very well.there no...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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...
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.