Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6704471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:17:33+00:00 2026-05-26T07:17:33+00:00

I need to write a VB.Net Winform application that is called through Windows’ context

  • 0

I need to write a VB.Net Winform application that is called through Windows’ context menu in Explorer and can take multiple parameters, where the final parameter is the full path to a file with spaces in it.

I tried the following as parameters, to no avail:

This is a test "%1" -> this
"This is a test "%1"" -> This is a test C:\Program
"This is a test" "%1" -> This is a test
"This is a test "%1%"" -> This is a test

Does someone know how to get Windows to pass the full path to the filename?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:17:34+00:00Added an answer on May 26, 2026 at 7:17 am

    Windows is passing the full path. You’re just having trouble parsing it.

    This is a test "%1" -> This is a test "C:\Program Files\Blah blah"
    -> cmdArgs(0) = "This"
    -> cmdArgs(1) = "is"
    -> cmdArgs(2) = "a"
    -> cmdArgs(3) = "test"
    -> cmdArgs(4) = "C:\Program Files\Blah blah"
    

    In the above example, since there are no quotation marks around the words in the phrase “This is a test”, they get passed as separate command line arguments.

    "This is a test "%1"" -> "This is a test "C:\Program Files\Blah blah""
    -> cmdArgs(0) = "This is a test "
    -> cmdArgs(1) = "C:\Program"
    -> cmdArgs(2) = "Files\Blah"
    -> cmdArgs(3) = "blah"
    

    In the second example, the quotation marks you inserted before the %1 terminated the first argument, leaving the actual file name unquoted.

    "This is a test" "%1" -> "This is a test" "C:\Program Files\Blah blah"
    -> cmdArgs(0) = "This is a test"
    -> cmdArgs(1) = "C:\Program Files\Blah blah"
    

    In the third example, the two arguments are quoted separately, so they arrive cleanly as two arguments to your program. This is the one you should be using. Your problem is that you are looking only at cmdArgs(0) and ignoring the other stuff in the rest of cmdArgs. In particular, you forgot to check out cmdArgs(1), which is where the filename is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to write a .NET application that listens to a SMS message ,
I'm planning to write a web application (.net probably) that will need to analyze
I'm new to .Net and c# and need to write a application that performs
I need to write a VB.Net 2008 applet to go through all the fixed-drives
I need to write robust code in .NET to enable a windows service (server
I need to write a simple C# .NET application to retrieve, update, and insert
I need to write a web application using SQL Server 2005, asp.net, and ado.net.
I need to re-write a businesss InfoPath / SharePoint application that has a fair
I need to write some .NET code that runs on a regular interval to
I'm going to write a rather big/complex WinForm application such as Paint.NET, SharpDevelop, etc.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.