vbscript - Active Setup - script to edit file not running/working -


have following batch file:

cscript myvb.vbs "c:\users\%username%\appdata\locallow\file.ini" "things" "stuff" 

vb script file:

const forreading = 1 const forwriting = 2  strfilename = wscript.arguments(0)  strfindtext = wscript.arguments(1)  strnewtext = wscript.arguments(1) & vbcrlf & wscript.arguments(2)  set objfso = createobject("scripting.filesystemobject") set objfile = objfso.opentextfile(strfilename, forreading)  strtext = objfile.readall objfile.close strnewtext = replace(strtext, strfindtext, stffindtext&strnewtext)  set objfile = objfso.opentextfile(strfilename, forwriting) objfile.write strnewtext objfile.close  set objfile = nothing 

and batch file set activesetup:

@echo off rem copy batch file xcopy mybat.bat* %systemroot%\ xcopy myvb.vbs* %systemroot%\  rem create active setup component run batch file reg add "hkey_local_machine\software\microsoft\active setup\installed components\mysetup" /v "version" /t reg_sz /d "1" /f  reg add "hkey_local_machine\software\microsoft\active setup\installed components\mysetup" /v "stubpath" /t reg_sz /d "%systemroot%\mybat.bat" /f 

if mybat executed manually, file edited fine. however, file not change after logging in. undid changes file , cleared active setup registry entry in profile between tests.

is there permissions issue missing? %username% coming out not expect to?

got working indicating full path vbs in bat file

cscript "%~dp0myvb.vbs" "c:\users\%username%\appdata\locallow\file.ini" "things" "stuff" 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -