registry %1 argument and short/long path names 
Author Message
 registry %1 argument and short/long path names

I have a registry entry that is configured as a context menu shortcut,
like this:
 wscript.exe c:\somepath\myscript.vbs  "%1"
but myscript parses the argument[0] as a short (8.3)path.  Is there a way to
force a LONG path name to be returned to myscript.vbs without having
to parse out myself?? (the argument gets chopped at the ~ character in 8.3 name).

Thanks,
 - Mitch



Wed, 13 Oct 2004 02:32:49 GMT  
 registry %1 argument and short/long path names

Quote:
> ...  Is there a way to
> force a LONG path name to be returned to myscript.vbs without having
> to parse out myself?? (the argument gets chopped at the ~ character in 8.3
> name).

wscript.exe c:\somepath\myscript.vbs  "%L"

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--



Wed, 13 Oct 2004 02:42:16 GMT  
 registry %1 argument and short/long path names


Fri, 19 Jun 1992 00:00:00 GMT  
 registry %1 argument and short/long path names
Thanks Michael. Attached is script explaining why I need this information,
based on discussion in CAPICOM discussion group.
BTW, where is the documentation on registry  command options like this?

Thanks,
 - Mitch Gallant

'************************************************************
' File:    AutoSignWiz.vbs (WSH in VBScript)
' Author:  M. I. Gallant
' Date:    04/26/2002
' Site:    http://home.istar.ca/~neutron/wsh
'
' Provides drag/drop launching of Authenticode signcode.exe wizard
' with automatic file selection entered.
'
' Use also to provide context-menu semi-automation for signing:
' e.g:
'   HKEY_CLASSES_ROOT\VBSFile\Shell\Digitally Sign\Command
'         wscript.exe  c:\scriptaids\autosignwiz.vbs  "%L"
'*************************************************************

Option Explicit
Dim WshShell, sourcefile, fileargs
Const Wiz_Title = "Digital Signature Wizard"  ' Window title for wizard

set WshShell = WScript.CreateObject("WScript.Shell")

Set fileargs = WScript.Arguments
If fileargs.Count<1 Then
  WScript.Echo "autosignwiz.vbs is a drag/drop utility"
  WScript.Quit
 End If

  sourcefile = fileargs(0)   'get dragged file name
  ' WScript.Echo sourcefile

Wshshell.Run "signcode.exe" ,1    'execute signcode and return
While  NOT Wshshell.AppActivate(Wiz_Title)   ' wait until ResKit doc. window is available
 WScript.Sleep 200
Wend

Wshshell.AppActivate(Wiz_Title) 'make sure wizard is still selected
WScript.Sleep 200
Wshshell.SendKeys("{ENTER}")    'go to "File Selection" pane
WScript.Sleep 100
Wshshell.SendKeys(sourcefile)
WScript.Sleep 100
Wshshell.SendKeys("{ENTER}")    'go to "Signing Options" pane

'--- Allow user to continue from here, or customize with specific cert -------------------

Quote:

> > ...  Is there a way to
> > force a LONG path name to be returned to myscript.vbs without having
> > to parse out myself?? (the argument gets chopped at the ~ character in 8.3
> > name).

> wscript.exe c:\somepath\myscript.vbs  "%L"

> --
> Michael Harris
> Microsoft.MVP.Scripting
> Seattle WA US
> --



Wed, 13 Oct 2004 03:00:52 GMT  
 registry %1 argument and short/long path names


Quote:
> BTW, where is the documentation on registry  command options like this?

Yes, get Michael to find it... I've looked and looked and can't run it down.


Wed, 13 Oct 2004 04:09:48 GMT  
 registry %1 argument and short/long path names
Surely the right place for this information is here in the Shell Programmer's Guide:
" Extending Shortcut Menus"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shel...

Note that this article implies that the %1 is fully expanded and so should be
quoted thus:  "%1".
But on Win2000, at least for file path arguments, %1  produces a short path with no spaces,
and %L produces the fully expanded path name, with spaces.
Is this registry command argument behavior of %1 versus %L  OS dependent ??  Spending
quite some time searching google and MS docs didn't turn up any official docs on this.

BTW, usually using the short argument specifier %1 is not a problem for apps, but for
example if you browse the registry, you can see some examples (e.g. multimedia file classes)
where %L is used. However, my script tried to pass the short file name (with ~ characters)
which caused the problem with Wshshell.SendKeys(shortfilename) since ~ is interpreted
as as an "Enter" character in this function.
... so it was a choice of parsing out the ~ character, char at a time, or asking for
a nicer solution ... hence the original question  :-)

Cheers,
 - Mitch

Quote:



> > BTW, where is the documentation on registry  command options like this?

> Yes, get Michael to find it... I've looked and looked and can't run it down.



Wed, 13 Oct 2004 22:29:02 GMT  
 registry %1 argument and short/long path names
I did a search on this about 2 months ago and came up empty-handed after a
couple of days.  This may be a good question for one of the shell groups.


Quote:
> Surely the right place for this information is here in the Shell Programmer's
Guide:
> " Extending Shortcut Menus"

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shel...
m/shell/programmersguide/shell_basics/shell_basics_extending/context.asp
Quote:

> Note that this article implies that the %1 is fully expanded and so should be
> quoted thus:  "%1".
> But on Win2000, at least for file path arguments, %1  produces a short path
with no spaces,
> and %L produces the fully expanded path name, with spaces.
> Is this registry command argument behavior of %1 versus %L  OS dependent ??
Spending
> quite some time searching google and MS docs didn't turn up any official docs
on this.

> BTW, usually using the short argument specifier %1 is not a problem for apps,
but for
> example if you browse the registry, you can see some examples (e.g. multimedia
file classes)
> where %L is used. However, my script tried to pass the short file name (with ~
characters)
> which caused the problem with Wshshell.SendKeys(shortfilename) since ~ is
interpreted
> as as an "Enter" character in this function.
> ... so it was a choice of parsing out the ~ character, char at a time, or
asking for
> a nicer solution ... hence the original question  :-)

> Cheers,
>  - Mitch




> > > BTW, where is the documentation on registry  command options like this?

> > Yes, get Michael to find it... I've looked and looked and can't run it down.



Wed, 13 Oct 2004 23:05:50 GMT  
 registry %1 argument and short/long path names
hehe, then you would have spent  (a couple of days - 2 hours) more than I  ;-)
 - Mitch
Quote:

> I did a search on this about 2 months ago and came up empty-handed after a
> couple of days.  This may be a good question for one of the shell groups.



> > Surely the right place for this information is here in the Shell Programmer's
> Guide:
> > " Extending Shortcut Menus"

> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shel...
> m/shell/programmersguide/shell_basics/shell_basics_extending/context.asp

> > Note that this article implies that the %1 is fully expanded and so should be
> > quoted thus:  "%1".
> > But on Win2000, at least for file path arguments, %1  produces a short path
> with no spaces,
> > and %L produces the fully expanded path name, with spaces.
> > Is this registry command argument behavior of %1 versus %L  OS dependent ??
> Spending
> > quite some time searching google and MS docs didn't turn up any official docs
> on this.

> > BTW, usually using the short argument specifier %1 is not a problem for apps,
> but for
> > example if you browse the registry, you can see some examples (e.g. multimedia
> file classes)
> > where %L is used. However, my script tried to pass the short file name (with ~
> characters)
> > which caused the problem with Wshshell.SendKeys(shortfilename) since ~ is
> interpreted
> > as as an "Enter" character in this function.
> > ... so it was a choice of parsing out the ~ character, char at a time, or
> asking for
> > a nicer solution ... hence the original question  :-)

> > Cheers,
> >  - Mitch




> > > > BTW, where is the documentation on registry  command options like this?

> > > Yes, get Michael to find it... I've looked and looked and can't run it down.



Thu, 14 Oct 2004 00:10:25 GMT  
 registry %1 argument and short/long path names
The script for semi-automation of the signcode.exe wizard has been updated:
  http://home.iSTAR.ca/~neutron/wsh/autosignwiz/autosignwiz.vbs
Also, I have written a prelim. version of a registry config. tool to
configure the menu shortcut verbs for use with autosignwiz.vbs  at:
 http://home.iSTAR.ca/~neutron/wsh/autosignwiz/autosignregconfig.vbs

 - Mitch Gallant
   http://home.iSTAR.ca/~neutron/wsh

Quote:

> Thanks Michael. Attached is script explaining why I need this information,
> based on discussion in CAPICOM discussion group.
> BTW, where is the documentation on registry  command options like this?

> Thanks,
>  - Mitch Gallant

> '************************************************************
> ' File:    AutoSignWiz.vbs (WSH in VBScript)
> ' Author:  M. I. Gallant
> ' Date:    04/26/2002
> ' Site:    http://home.istar.ca/~neutron/wsh
> '

 -- snip
Quote:


> > > ...  Is there a way to
> > > force a LONG path name to be returned to myscript.vbs without having
> > > to parse out myself?? (the argument gets chopped at the ~ character in 8.3
> > > name).

> > wscript.exe c:\somepath\myscript.vbs  "%L"

> > --
> > Michael Harris
> > Microsoft.MVP.Scripting
> > Seattle WA US
> > --



Sun, 17 Oct 2004 00:58:36 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Converting Paths having short name to long versions

2. Converting Long File Names to Short File Names

3. Getting short file name from long file name:

4. Converting Long File Names to Short File Names

5. Converting Short File Names to Long File Names

6. Long Path Names give Runtime error 76 - Path not found

7. Long Path Names give Runtime error 76 - Path not found

8. Convert Long Path to Short

9. Long names from short.

10. how to get short path name

11. WSH Run does recognizes only short DOS convention file path names

12. Adding values to a registry key with a path in its name

 

 
Powered by phpBB® Forum Software