From: Allen on
I want to get the path of my current .vbs files

I use below script to get the path

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.GetFolder(".\").Path

But it only work when I run the script directly. If I drag a folder to the
script it return "Document and setting\User"

Please help / Allen

From: Richard Mueller [MVP] on

"Allen" <allenywl(a)hotmail.com> wrote in message
news:9323266E-788D-4B8C-9D44-59613ED9110D(a)microsoft.com...
>I want to get the path of my current .vbs files
>
> I use below script to get the path
>
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> objFSO.GetFolder(".\").Path
>
> But it only work when I run the script directly. If I drag a folder to the
> script it return "Document and setting\User"
>
> Please help / Allen

Use the Wscript object:

Wscript.Echo Wscript.ScriptFullName

Richard Mueller


From: Allen on
Work prefect.

Thanks/Allen

"Richard Mueller [MVP]" <rlmueller-nospam(a)ameritech.nospam.net> wrote in
message news:euBruDVjKHA.4912(a)TK2MSFTNGP02.phx.gbl...
>
> "Allen" <allenywl(a)hotmail.com> wrote in message
> news:9323266E-788D-4B8C-9D44-59613ED9110D(a)microsoft.com...
>>I want to get the path of my current .vbs files
>>
>> I use below script to get the path
>>
>> Set objFSO = CreateObject("Scripting.FileSystemObject")
>> objFSO.GetFolder(".\").Path
>>
>> But it only work when I run the script directly. If I drag a folder to
>> the script it return "Document and setting\User"
>>
>> Please help / Allen
>
> Use the Wscript object:
>
> Wscript.Echo Wscript.ScriptFullName
>
> Richard Mueller
>