473,657 Members | 2,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing filename with spaces to a shelled app?

I have an exe and need to pass a filepath which has spaces and would
normally be surrounded by " " if done from the Window Start -- Run dialog...

How can I get the quotes around the strings I pass to it?

Thanks,

Shane
Nov 21 '05 #1
6 8394
* "SStory" <Th*******@TAKE OUTTHISSPAMBUST ERsofthome.net> scripsit:
I have an exe and need to pass a filepath which has spaces and would
normally be surrounded by " " if done from the Window Start -- Run dialog...


Take a look at the 'ProcessStartIn fo' class and its 'FileName' and
'Arguments' properties. You can use 'Process.Start( psi)' to start an
application, 'psi' is your instance of 'ProcessStartIn fo'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2
Escape the double-quote characters with a back-slash (\). For example,
"\"C:\\My File.doc\"" will be treated as "C:\My File.doc"

Another option is to use verbatim strings (escape " with two consequtive "
chars) and prefix the whole string with @ char as in @"""C:\My File.doc""";

Hope this is what you are looking for.

"SStory" <Th*******@TAKE OUTTHISSPAMBUST ERsofthome.net> wrote in message
news:Of******** ******@tk2msftn gp13.phx.gbl...
I have an exe and need to pass a filepath which has spaces and would
normally be surrounded by " " if done from the Window Start -- Run dialog...

How can I get the quotes around the strings I pass to it?

Thanks,

Shane

Nov 21 '05 #3
Is this c# or VB?

"Shiva" <sh******@onlin e.excite.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Escape the double-quote characters with a back-slash (\). For example,
"\"C:\\My File.doc\"" will be treated as "C:\My File.doc"

Another option is to use verbatim strings (escape " with two consequtive "
chars) and prefix the whole string with @ char as in @"""C:\My File.doc""";
Hope this is what you are looking for.

"SStory" <Th*******@TAKE OUTTHISSPAMBUST ERsofthome.net> wrote in message
news:Of******** ******@tk2msftn gp13.phx.gbl...
I have an exe and need to pass a filepath which has spaces and would
normally be surrounded by " " if done from the Window Start -- Run dialog...
How can I get the quotes around the strings I pass to it?

Thanks,

Shane

Nov 21 '05 #4
"SStory" <Th*******@TAKE OUTTHISSPAMBUST ERsofthome.net> skrev i en meddelelse
news:er******** ******@TK2MSFTN GP12.phx.gbl...
Is this c# or VB?

"Shiva" <sh******@onlin e.excite.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Escape the double-quote characters with a back-slash (\). For example,
"\"C:\\My File.doc\"" will be treated as "C:\My File.doc"

Another option is to use verbatim strings (escape " with two consequtive " chars) and prefix the whole string with @ char as in @"""C:\My

File.doc""";


It is C#.

In VB, you use double quotes, i.e. """C:\My File.doc""". There is no VB.NET
equivalent to verbatim strings, unfortunately.

/Jens

--
Jens Christian Mikkelsen
http://www.jcmikkelsen.dk
Nov 21 '05 #5
Sorry, it is C#.

For VB, escape " with two consequtive " chars as in """C:\My File.doc"""

"SStory" <Th*******@TAKE OUTTHISSPAMBUST ERsofthome.net> wrote in message
news:er******** ******@TK2MSFTN GP12.phx.gbl...
Is this c# or VB?

"Shiva" <sh******@onlin e.excite.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Escape the double-quote characters with a back-slash (\). For example,
"\"C:\\My File.doc\"" will be treated as "C:\My File.doc"

Another option is to use verbatim strings (escape " with two consequtive "
chars) and prefix the whole string with @ char as in @"""C:\My File.doc""";
Hope this is what you are looking for.

"SStory" <Th*******@TAKE OUTTHISSPAMBUST ERsofthome.net> wrote in message
news:Of******** ******@tk2msftn gp13.phx.gbl...
I have an exe and need to pass a filepath which has spaces and would
normally be surrounded by " " if done from the Window Start -- Run dialog...
How can I get the quotes around the strings I pass to it?

Thanks,

Shane


Nov 21 '05 #6
Thanks... I was just wondering if there was something else I wasn't aware of
in VB.NEt....

Thanks,

shane
"Shiva" <sh******@onlin e.excite.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Sorry, it is C#.

For VB, escape " with two consequtive " chars as in """C:\My File.doc"""

"SStory" <Th*******@TAKE OUTTHISSPAMBUST ERsofthome.net> wrote in message
news:er******** ******@TK2MSFTN GP12.phx.gbl...
Is this c# or VB?

"Shiva" <sh******@onlin e.excite.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Escape the double-quote characters with a back-slash (\). For example,
"\"C:\\My File.doc\"" will be treated as "C:\My File.doc"

Another option is to use verbatim strings (escape " with two consequtive " chars) and prefix the whole string with @ char as in @"""C:\My

File.doc""";

Hope this is what you are looking for.

"SStory" <Th*******@TAKE OUTTHISSPAMBUST ERsofthome.net> wrote in message
news:Of******** ******@tk2msftn gp13.phx.gbl...
I have an exe and need to pass a filepath which has spaces and would
normally be surrounded by " " if done from the Window Start -- Run

dialog...

How can I get the quotes around the strings I pass to it?

Thanks,

Shane


Nov 21 '05 #7

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

Similar topics

4
7490
by: J Bunton | last post by:
ShellStr = "C:\temp\wzzip " & ZipOptions & " " & ZipTo & " " & ZipFrom ShellRet=Shell(ShellStr) .. . . . . . msgbox "Done" How can I determin whether the Shelled process is still running.
11
3232
by: hokiegal99 | last post by:
How would I determine if a filename is greater than a certain number of characters and then truncate it to that number? For example a file named XXXXXXXXX.txt would become XXXXXX fname = files if fname > 6 print fname Thanks!!!
5
1577
by: Michael Sgier | last post by:
Hello i don't understand the visibility/passing of variables. I've in texture.h: class CTexture { public: unsigned int texID; GLuint texture;
6
2485
by: Henke | last post by:
I have a web application that is used to transfer files to and from a database. The files are streamed and stored in the database that is. From one page I can download the files to the client, by clicking on the filename. The confirm download popup (the one built-in in IE) is displayed and I can select either Save or Open. One the file name row the name of the file is displayed but all " " (spaces) are replaced with a "+"-sign. Does...
4
1843
by: Mohsen Aghazadeh | last post by:
In my application I wait for a shelled application to finish and continue to work. Everything works fine but when the shelled program is up and user tries to open other applications (outside of my application) they will not be opened till the shelled program finishes. I appreciate you help on this issue. Thanks, Mohsen
2
2565
by: Colmag | last post by:
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")
13
7234
by: Bryan Parkoff | last post by:
I have seen that C/C++ Compiler supports long filename up to 254 characters plus the extension. Can header files and source code files accept space between alphabet character and numeric character? Is it the best practice to use underscore instead of space? If so, please explain why. Would you prefer to avoid using two double quote marks in the long filename if space is there? Without it, it would be underspace. For example:
6
1541
by: rdemyan via AccessMonster.com | last post by:
Is there a way, in code, to move a shelled application on the screen. I've got the shelled app to open and it centers itself. I would like to move it to the right using code, but I don't know how. Here's the line of code I have so far: varAppID = Shell(strShell, vbNormalFocus) It opens fine. Also, is there a way to open the shelled application modally, so that the user has to deal with it immediately. The specific app that I'm...
4
2589
by: Acrobatic | last post by:
I'm having troubles uploading an image and getting data from getimagesize(). When I upload a file with the name "20050914_loRes_XLH1.jpg", and do a getimagesize on it, it returns no info (null and empty). However, if I change the filename to something like "camera.jpg" and upload it, getimagesize() works perfectly, and I can print_r the array of data. PHP is uploading the files to my /var/temp directory just fine. Also, I have all...
0
8425
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8326
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8743
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8622
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.