VBScript for amend text file
VBScript for amend text file
VBScript for amend text file
VBScript for amend text file
VBScript for amend text file
VBScript for amend text file VBScript for amend text file VBScript for amend text file VBScript for amend text file VBScript for amend text file VBScript for amend text file VBScript for amend text file VBScript for amend text file
VBScript for amend text file VBScript for amend text file
VBScript for amend text file
Go Back  Xtreme Visual Basic Talk > > > VBScript for amend text file


Reply
 
Thread Tools Display Modes
  #1  
Old 07-29-2012, 08:28 PM
maharaskal maharaskal is offline
Newcomer
 
Join Date: Dec 2006
Posts: 3
Default VBScript for amend text file


Hi Guys,
the below script is the one to amend text file a to text file b.

kindly assist me. this below script is not working. kindly help me.
thanks in advance

Code:
Option Explicit
Dim ObjShell
If WScript.Arguments.length = 0 Then
Set ObjShell = CreateObject("Shell.Application")
ObjShell.ShellExecute "wscript.exe", """" & _
WScript.ScriptFullName & """" &_
" RunAsAdministrator", , "runas", 1
Else
'Code here
Dim wshShell, fileSys, oProcEnv, sTemp, sDir, sFile, Source, Target, curPath
'---------------------------------
'Set objShell = CreateObject("Shell.Application")
Set wshShell = WScript.CreateObject("WScript.Shell")
Set fileSys = CreateObject("Scripting.FileSystemObject")
Set oProcEnv = wshShell.Environment("PROCESS")
sTemp = oProcEnv("Temp")
'curPath = fileSys.GetAbsolutePathName(".")
'---------------------------------
'---------------------------------
On Error Resume Next
sFile = "hosts"
'Source = curPath & "\Logs\" & sfile
sDir = wshShell.ExpandEnvironmentStrings("%system32%\drivers\etc\")
Source = sFile
Target = sDir & sFile
'Target  = curPath & "\Logs\" & sfile
fileSys.CopyFile (Source), (Target)
fileSys.DeleteFile(Source) 
Set fileSys = nothing
End If
Reply With Quote
Reply

Tags
vbscript


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
VBScript for amend text file
VBScript for amend text file
VBScript for amend text file VBScript for amend text file
VBScript for amend text file
VBScript for amend text file
VBScript for amend text file VBScript for amend text file VBScript for amend text file VBScript for amend text file VBScript for amend text file VBScript for amend text file VBScript for amend text file
VBScript for amend text file
VBScript for amend text file
 
VBScript for amend text file
VBScript for amend text file
 
-->