Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , ,

Sponsored Links



Create .bat and insert lines from .vbs

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 19-03-2010
Member
 
Join Date: Nov 2008
Posts: 12
Create .bat and insert lines from .vbs

I need to create a .bat file from a VB script. It also needs to copy some lines into the new batch file.

Example:
If value = something1 Then
' create .bat file and insert into batch file:
Sh.Run("%systemdrive%\Software\McAfee\EPO\FramePkg.exe"), 0, True

If value = something2 Then
' create .bat file and insert into batch file:
Sh.Run("%systemdrive%\Software\McAfee\Standalone\Install.bat"), 0, True
End if

Thanks!
Reply With Quote
  #2  
Old 08-05-2010
opaper's Avatar
Member
 
Join Date: May 2008
Posts: 2,362
Re: Create .bat and insert lines from .vbs

Creating a batch file very simple. You simply type in your code into a notepad file which may include the above lines and instead of saving it as *.txt file, you save it as *.bat. That's it. This is the basic logic. So you generate the code which will copy your code in the a file and save it as .bat file. Its very time consuming to give you the complete code and so I just gave you the logic.
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #3  
Old 08-05-2010
Member
 
Join Date: May 2008
Posts: 1,990
Create .bat and insert lines from .vbs

I think, you need to view this and from here you can find the best one according to your suggested issues...you need to follow some instructions and if you are getting any issues then feel free to post me...

1) Create .bat from .vbs:
.
2) Append to .bat from .vbs

Code:
textfilemodes used by filesystemobject:
const forreading=1
const forwriting=2
const forappending=8
example append:
set bat=opentextfile("existing.bat",8)
bat.writeline "appended line here"
bat.close
Reply With Quote
  #4  
Old 08-05-2010
Member
 
Join Date: Nov 2008
Posts: 12
Re: Create .bat and insert lines from .vbs

opaper - please read the post. It says create .bat FROM a .vbs.

Katty - Thanks. I found out how to do it and it works great.
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Create .bat and insert lines from .vbs"
Thread Thread Starter Forum Replies Last Post
Why are T1 lines so expensive? Shakaal Networking & Security 4 16-09-2010 01:18 PM
Don't know how to insert or create AutoText in Microsoft Word Khan Baba Windows Software 5 22-01-2010 12:41 PM
How to insert random lines MADGE25 Software Development 4 25-11-2009 05:16 PM
How to use sed to insert lines in a file McGrawh Software Development 2 25-06-2009 12:45 AM
How do I create a textbox in vb that lets you insert tabs? Chandrakant81 Software Development 3 26-02-2009 09:59 PM


All times are GMT +5.5. The time now is 04:17 AM.