Solved

Renaming File Types

Posted on 2006-06-27
4
169 Views
Last Modified: 2011-09-20
Hi Guys.. easy one for y'all..

I have a program that feeds lines of text into a .txt file (C:\update.txt)

the way i have designed it to output the results means if i change the file extension to .bat, it will become a working batch file.  how do i change the extension in vb6?

I do have filesystemobject setup and running :)
0
Comment
Question by:NAORC
4 Comments
 
LVL 15

Expert Comment

by:cquinn
Comment Utility
Why not create the file as C:\update.bat in the first place?

0
 
LVL 5

Author Comment

by:NAORC
Comment Utility
Set m_destTS = m_fso.CreateTextFile("C:\ORCGravity\update.txt", True)

^^throws up errors if i do^^
0
 
LVL 13

Accepted Solution

by:
Mark_FreeSoftware earned 125 total points
Comment Utility
try this:

dim tmp as string
tmp = "c:\update.txt"
tmp = replace(tmp,".txt",".bat")

now you have "c:\update.bat" in tmp!
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
Comment Utility
"how do i change the extension in vb6?"

In VB6, you can use the Name function to rename a file:

    Dim oldFileName As String
    Dim newFileName As String
   
    oldFileName = "c:\someFile.txt"
    newFileName = "c:\someFile.bat"
   
    Name oldFileName As newFileName
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now