Forum Moderators: open

Message Too Old, No Replies

VBscript

changing a filename

         

Andrew Thomas

1:47 pm on Apr 9, 2002 (gmt 0)

10+ Year Member



I have a variable called storednum, which will hold a filename called test.ord After a certain process i want the file to be renamed test_02.ord.

How do i dos this in vb script?

thanks

Andrew Thomas

1:50 pm on Apr 9, 2002 (gmt 0)

10+ Year Member



In other words whats the syntax for adding the _02.ord on the end

thanks

txbakers

5:11 pm on Apr 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think it goes like this:

dim src
dim file

src = "test"
file = src + "_02.htm"

or something like that.

Andrew Thomas

5:25 pm on Apr 9, 2002 (gmt 0)

10+ Year Member



thanks

Xoc

5:37 pm on Apr 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should use the & for string concatination in vbscript. + works, but & works better.

dim src
dim file

src = "test"
file = src & "_02.htm"

txbakers

5:41 pm on Apr 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



absolutely right about using the & instead of the +

I get my scripting languages confused sometimes.