Hi,

I have a string that contains the full path to a file (eg: "C:\Program
Files\folder\directory\app.exe". What I need is a way of removing the
"\app.exe" so that I can have just the path.

I checked around but none of the solutions worked when I put the code in
a VBS file. How can I do that with a .VBS file?


thanks

--
Alec
asoroudi@synetech.cjb.net

Re: ? Find last instance of substring in a string by Jimmy

Jimmy
Tue Dec 02 21:25:55 CST 2003

Hi,

>-----Original Message-----
> Hi,
>
> I have a string that contains the full path to a=20
file (eg: "C:\Program
>Files\folder\directory\app.exe". What I need is a way=20
of removing the
>"\app.exe" so that I can have just the path.
>
> I checked around but none of the solutions worked=20
when I put the code in
>a VBS file. How can I do that with a .VBS file?
>
>
>thanks
>
>--
>Alec
>asoroudi@synetech.cjb.net
>
>
>=01
>
>
>.
>

How about this ?

a =3D "C:\Program Files\folder\directory\app.exe" =20
wscript.echo left(a,instrrev(a,"\")-1)

Regards,
Jimmy

Re: ? Find last instance of substring in a string by Alec

Alec
Tue Dec 02 22:03:31 CST 2003

Well that worked perfectly. Thanks.

It's been over a decade since I worked with *BASIC*... :'\


--
Alec
asoroudi@synetech.cjb.net



"Jimmy" <jimmyhk2000@yahoo.com.hk_NO_SPAM> wrote in message
news:bb1101c3b94d$29780e20$a601280a@phx.gbl...
Hi,

>-----Original Message-----
> Hi,
>
> I have a string that contains the full path to a
file (eg: "C:\Program
>Files\folder\directory\app.exe". What I need is a way
of removing the
>"\app.exe" so that I can have just the path.
>
> I checked around but none of the solutions worked
when I put the code in
>a VBS file. How can I do that with a .VBS file?
>
>
>thanks
>
>--
>Alec
>asoroudi@synetech.cjb.net
>
>
>
>
>
>.
>

How about this ?

a = "C:\Program Files\folder\directory\app.exe"
wscript.echo left(a,instrrev(a,"\")-1)

Regards,
Jimmy



Re: ? Find last instance of substring in a string by Ingo

Ingo
Wed Dec 03 08:07:45 CST 2003

Hi,

if it is a real filename, use from the FileSystemObject the function
"GetBaseName"

Ingo

"Alec Soroudi" <a@a.com> schrieb im Newsbeitrag
news:uN2PIuUuDHA.2444@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> I have a string that contains the full path to a file (eg: "C:\Program
> Files\folder\directory\app.exe". What I need is a way of removing the
> "\app.exe" so that I can have just the path.
>
> I checked around but none of the solutions worked when I put the code
in
> a VBS file. How can I do that with a .VBS file?
>
>
> thanks
>
> --
> Alec
> asoroudi@synetech.cjb.net
>
>
> 
>
>