Citation :
Dim shell, args, fso, f
Set args = Wscript.Arguments
Set shell = WScript.CreateObject("WScript.Shell" )
Set fso = WScript.CreateObject("Scripting.FileSystemObject" )
If args.count=0 Then ' Auto-installation
Script=Wscript.ScriptFullName
Key="HKEY_CLASSES_ROOT\*\shell\test_vbs\"
shell.RegWrite Key,"Test VBS"
Command="cscript """ & Script & """ ""%1"""
shell.RegWrite Key & "command\",Command
MsgBox "Script "& Script &" installé", vbInformation, "Test VBS"
wscript.quit
End If
path=args(0)
set f=Get_Long_Name(path)
MsgBox f
Private Declare Function GetLongPathName Lib "KERNEL32.DLL" Alias "GetLongPathNameA" _
(ByVal lptstrShortName As String, _
ByVal lpctstrLongName As String, _
ByVal bufLen As Long) As Long
Function Get_Long_Name(CourtStr As String) As String
Dim LongStr As String
Dim lStrLen As Long, lRet As Long
lRet = GetLongPathName(CourtStr, LongStr, lStrLen)
LongStr = String(lRet, " " )
lRet = GetLongPathName(CourtStr, LongStr, lRet)
Get_Long_Name = LongStr
End Function
|