how do i remove characters like at the end with VBS? i am trying to get the string of the filename without the extension
Page 1 of 1
VBS substring
#2
Posted 28 February 2008 - 08:02 AM
Right(string,y) function to get the right side of string to len y
Left(string,y) to get the left side of string for len y
Mid(string, x, [len y]) to get substring from the point x to len y, if y is omitted go to end of string.
Left(string,y) to get the left side of string for len y
Mid(string, x, [len y]) to get substring from the point x to len y, if y is omitted go to end of string.
#3
Posted 28 February 2008 - 08:59 AM
oh ya thanks, didn't think abt this, usually in many programming languages there is a substring function lol
#4
Posted 28 February 2008 - 09:09 AM
You may want to look at using the FileSystem Object for your purpose here.
You can see an example here:
http://www.devguru.com/technologies/vbscri...etbasename.html
You can see an example here:
http://www.devguru.com/technologies/vbscri...etbasename.html
#5
Posted 28 February 2008 - 09:12 AM
You could also use the Split method or Split and Replace methods
Example
You have this path
C:\SomeFolder\Folder\Name.Ext
Example Split
Example Split And Replace
Example
You have this path
C:\SomeFolder\Folder\Name.Ext
Example Split
Quote
Dim F1, F2, F3
F1 = Split("C:\SomeFolder\Folder\Name.Ext","\")
For Each F2 In F1
F3 = F2
Next
F1 = Split(F3,".")
WScript.Echo F1(0) & vbCrLf & F1(1)
Example Split And Replace
Quote
Dim F1, F2, F3
F1 = Split("C:\SomeFolder\Folder\Name.Ext","\")
For Each F2 In F1
F3 = Replace(F2,".Ext","")
Next
WScript.Echo F3
- ← Dos 6.22 For
- Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
- VBScript for Duplex Printing reqd. →
Share this topic:
Page 1 of 1



Help

Back to top









