Jump to content

trying to get path and file name


Recommended Posts

thank you UEZ!

that was pretty comprehensive and included every example i ran by it.  this was the only path i came across where it didn't work

C:\ProgramData\bomgar-scc-cb\rs.company.com\embedhook-x86.exe --start rs.company.com --all-users

its good enough though :)

thanks again!

Link to comment
Share on other sites

Strangely the one I wrote after UEZ' comment works ... :whistle:

Local $a = "C:\ProgramData\bomgar-scc-cb\rs.company.com\embedhook-x86.exe --start rs.company.com --all-users"

$path = StringRegExpReplace($a, '.*(\S+:\\.+?)(?=\s[/-]+\w+(?:\s|$)|$).*', "$1")
$detail = StringRegExp($path, '^(.+)\\(.+)$', 3)
Msgbox(0,"", $path &@crlf& $detail[0] &@crlf& $detail[1])

 

Link to comment
Share on other sites

53 minutes ago, gcue said:

thank you UEZ!

that was pretty comprehensive and included every example i ran by it.  this was the only path i came across where it didn't work

C:\ProgramData\bomgar-scc-cb\rs.company.com\embedhook-x86.exe --start rs.company.com --all-users

its good enough though :)

thanks again!

If you know the file extensions you can use

$sPath = StringRegExp($sCmd, ".*\b([\w]\:.+\.[exe|msi|zip|cmd|bat]+)\b\s*", 3)[0]

but this is a lame solution.

mikell is the regex guru :D

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...