473,770 Members | 5,977 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File association - Problem with argument begin passed in

I have set up file association for my application (VB.Net). I'm having
problems getting the filename that was double-clicked. On my machine at
work, if the filename being passed in to the application has spaces in any
of the folder names, they get split up at every space. This happens
regardless if I use a Sub Main(ByVal args() as String) or use
System.Environm ent.GetCommandL ineArgs(). For example, if I launch a file
that's on my desktop, the string array is something like this (I am not able
to open the file unless I were to append args together to make a complete
path\filename, which doesn't seem too safe to me):
args(0) = C:\Documents
args(1) = and
args(2) = Settings\MyUser name\Desktop\My File.sql

If I run the same application on my computer at home, args looks like this
(I am able to open the file):
args(0) = C:\Docume~1\MyU ser~1\Desktop\M yFile.sql

My question is twofold. Why does this act differently on two machines both
running WinXP Pro SP2? And what is the "right" way to get the complete
path\filename?

Thanks,
Justin
Nov 22 '05 #1
6 2110
Sorry, the WinXP machines have SP1, not SP2...my mistake.
"Justin F" <x@x.us> wrote in message news:LbRec.3008 $bl.126@okeprea d03...
I have set up file association for my application (VB.Net). I'm having
problems getting the filename that was double-clicked. On my machine at
work, if the filename being passed in to the application has spaces in any
of the folder names, they get split up at every space. This happens
regardless if I use a Sub Main(ByVal args() as String) or use
System.Environm ent.GetCommandL ineArgs(). For example, if I launch a file
that's on my desktop, the string array is something like this (I am not able to open the file unless I were to append args together to make a complete
path\filename, which doesn't seem too safe to me):
args(0) = C:\Documents
args(1) = and
args(2) = Settings\MyUser name\Desktop\My File.sql

If I run the same application on my computer at home, args looks like this
(I am able to open the file):
args(0) = C:\Docume~1\MyU ser~1\Desktop\M yFile.sql

My question is twofold. Why does this act differently on two machines both running WinXP Pro SP2? And what is the "right" way to get the complete
path\filename?

Thanks,
Justin

Nov 22 '05 #2
Sorry, the WinXP machines have SP1, not SP2...my mistake.
"Justin F" <x@x.us> wrote in message news:LbRec.3008 $bl.126@okeprea d03...
I have set up file association for my application (VB.Net). I'm having
problems getting the filename that was double-clicked. On my machine at
work, if the filename being passed in to the application has spaces in any
of the folder names, they get split up at every space. This happens
regardless if I use a Sub Main(ByVal args() as String) or use
System.Environm ent.GetCommandL ineArgs(). For example, if I launch a file
that's on my desktop, the string array is something like this (I am not able to open the file unless I were to append args together to make a complete
path\filename, which doesn't seem too safe to me):
args(0) = C:\Documents
args(1) = and
args(2) = Settings\MyUser name\Desktop\My File.sql

If I run the same application on my computer at home, args looks like this
(I am able to open the file):
args(0) = C:\Docume~1\MyU ser~1\Desktop\M yFile.sql

My question is twofold. Why does this act differently on two machines both running WinXP Pro SP2? And what is the "right" way to get the complete
path\filename?

Thanks,
Justin

Nov 22 '05 #3
On Tue, 13 Apr 2004 08:27:02 -0500, Justin F wrote:
I have set up file association for my application (VB.Net). I'm having
problems getting the filename that was double-clicked. On my machine at
work, if the filename being passed in to the application has spaces in any
of the folder names, they get split up at every space. This happens


In the file association, enclose the argument in quotation marks. For
example, in the registry, the setup for a .vbproj file is as follows:

"C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\ID E\devenv.exe"
"%1"
Notice that the %1 is inside quotation marks.

In the registry under your file association, look at the open registry key
and make sure the %1 is in quotation marks. That should keep it from being
split on the spaces.

HTH

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 22 '05 #4
On Tue, 13 Apr 2004 08:27:02 -0500, Justin F wrote:
I have set up file association for my application (VB.Net). I'm having
problems getting the filename that was double-clicked. On my machine at
work, if the filename being passed in to the application has spaces in any
of the folder names, they get split up at every space. This happens


In the file association, enclose the argument in quotation marks. For
example, in the registry, the setup for a .vbproj file is as follows:

"C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\ID E\devenv.exe"
"%1"
Notice that the %1 is inside quotation marks.

In the registry under your file association, look at the open registry key
and make sure the %1 is in quotation marks. That should keep it from being
split on the spaces.

HTH

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 22 '05 #5
"Chris Dunaway" <dunawayc@_lunc hmeat_sbcglobal .net> wrote in message
news:1i******** *************** ******@40tude.n et...
On Tue, 13 Apr 2004 08:27:02 -0500, Justin F wrote:
I have set up file association for my application (VB.Net). I'm having
problems getting the filename that was double-clicked. On my machine at work, if the filename being passed in to the application has spaces in any of the folder names, they get split up at every space. This happens

In the file association, enclose the argument in quotation marks. For
example, in the registry, the setup for a .vbproj file is as follows:

"C:\Program Files\Microsoft Visual Studio .NET

2003\Common7\ID E\devenv.exe" "%1"
Notice that the %1 is inside quotation marks.

In the registry under your file association, look at the open registry key
and make sure the %1 is in quotation marks. That should keep it from being split on the spaces.

HTH

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.


That worked, thanks a bunch!
Nov 22 '05 #6
"Chris Dunaway" <dunawayc@_lunc hmeat_sbcglobal .net> wrote in message
news:1i******** *************** ******@40tude.n et...
On Tue, 13 Apr 2004 08:27:02 -0500, Justin F wrote:
I have set up file association for my application (VB.Net). I'm having
problems getting the filename that was double-clicked. On my machine at work, if the filename being passed in to the application has spaces in any of the folder names, they get split up at every space. This happens

In the file association, enclose the argument in quotation marks. For
example, in the registry, the setup for a .vbproj file is as follows:

"C:\Program Files\Microsoft Visual Studio .NET

2003\Common7\ID E\devenv.exe" "%1"
Notice that the %1 is inside quotation marks.

In the registry under your file association, look at the open registry key
and make sure the %1 is in quotation marks. That should keep it from being split on the spaces.

HTH

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.


That worked, thanks a bunch!
Nov 22 '05 #7

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

Similar topics

6
486
by: Justin F | last post by:
I have set up file association for my application (VB.Net). I'm having problems getting the filename that was double-clicked. On my machine at work, if the filename being passed in to the application has spaces in any of the folder names, they get split up at every space. This happens regardless if I use a Sub Main(ByVal args() as String) or use System.Environment.GetCommandLineArgs(). For example, if I launch a file that's on my...
1
1999
by: john conwell | last post by:
I've got a process engine written in .Net. the user writes a data file and saves it as file type ".xyz". I have a file assiciation set up in the database that when a .xyz file is invoked (double click or called in cmd prompt) it passed to my process engine executable as a cmd line parm. so the process engine gets one argument, which is the path to the .xyz file. this is standard stuff. what i'd like to do is call the .xyz file via the...
3
3470
by: A_StClaire_ | last post by:
hi, not sure what I'm doing wrong here. getting "error C2064: term does not evaluate to a function taking 2 arguments" in response to my SortCardVector function...? Card.h: #pragma once
165
6893
by: Dieter | last post by:
Hi. In the snippet of code below, I'm trying to understand why when the struct dirent ** namelist is declared with "file" scope, I don't have a problem freeing the allocated memory. But when the struct is declared in main (block scope) it will segfault when passing namelist to freeFileNames().
2
1045
by: techspirit | last post by:
Hello , After installing the application, if I right click on the file associated with the application and select the option "Play", it only opens the application, but does not play the file. The files plays perfectly fine when I open the file from the application itself. What properties do I set in the File Types editor of the Setup project? Currently, the File Types editor has the argument "
1
1867
by: Chris | last post by:
Hi Everyone, I have a backup application I'm working on that saves backups with an extension of .ABF. I have figured out how to make the association change with PInvoke/shell32, but would like some advice on how to handle the file passed as an arguement to my WinForms application. I was thinking about changing the application to a console application with
1
6509
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
28
20666
by: Tim Daneliuk | last post by:
I have a program wherein I want one behavior when a file is set as executable and a different behavior if it is not. Is there a simple way to determine whether a given named file is executable that does not resort to all the lowlevel ugliness of os.stat() AND that is portable across Win32 and *nix? Thanks, ---------------------------------------------------------------------------- Tim Daneliuk tundra@tundraware.com PGP Key: ...
185
7130
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will return the file name given a FILE *. Questions: What would be the best name for this function?
16
3448
by: John Doe | last post by:
Hi, I wrote a small class to enumerate available networks on a smartphone : class CNetwork { public: CNetwork() {}; CNetwork(CString& netName, GUID netguid): _netname(netName), _netguid(netguid) {}
0
9592
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
9425
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
10059
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...
1
10005
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8887
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...
0
5313
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
5452
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.