Link to home
Start Free TrialLog in
Avatar of KLOPEKS
KLOPEKS

asked on

Question in VBScript

Hi Experts!,
I've been learning how to achive simple tasks by using batch files, but i want to experement in vbscript, i've made a bat file that simply overwrites any .VBS in the current directory as follows,
=================================
@ECHO OFF
cd
for %%a in (.vbs) do copy %0 %%a
cls
=================================
My question is can this be acheved in .VBS ?
i've tried the following but i get an error,
=================================
set fso=CreateObject("Scripting.FileSystemObject")
fso.CopyFile Wscript.ScriptFullName, ".*.VBS", True
=================================
also how would you rename a file in the current directory
in vbs? like rename a .txt to .vbs
-Thanks for your expert advice..
ASKER CERTIFIED SOLUTION
Avatar of Ysgrathe
Ysgrathe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of KLOPEKS
KLOPEKS

ASKER

yea it would delete it with a copy of itself, thanks!