none
how to rename files in specific folder and/or delete these files: dos batch file

    Question

  • have some stubborn files that only delete with unlocker by renaming the dll and exe files anyone have some tips for renaming in specific directory? I dont want it to be the generic script you drop in the folder then run it or someone will mess up a pc by mistake. needs to be specific current script: leaves these two files behind: netcfgsvr.exe Diagnostic.dll -the dll is dependent on the exe. if you rename the exe you can delete the dll. i'd like to force rename, force unregister/kill and force delete each file. =============================================

    echo "Jeremy's dll removal tool"
    for /d %%j in ("%ProgramFiles%\AT&T Global Network Client\*") do call :DelTDir "%%j"
    del "%~1\%%ProgramFiles%\AT&T Global Network Client\." /f /s /q /a
    del "%~1\%%ProgramFiles%\AT&T Global Network Client\*.*" /f /s /q /a
    rem echo ie temporary internet files cleaned
    
    del /f /s /q /a "C:\Program Files\AT&T Global Network Client\netcfgsvr.exe"
    
    attrib -h -r -s "%ProgramFiles%\AT&T Global Network Client\AVManagerUnified.dll"
    regsvr32 /u /s "%ProgramFiles%\AT&T Global Network Client\AVManagerUnified.dll"
    del /f /s /q /a "%ProgramFiles%\AT&T Global Network Client\AVManagerUnified.dll"
    echo "deleted"
    
    attrib -h -r -s "%ProgramFiles%\AT&T Global Network Client\*.dll"
    regsvr32 /u "%ProgramFiles%\AT&T Global Network Client\*.dll"
    del /f /s /q /a "%ProgramFiles%\AT&T Global Network Client\*.dll"
    
    attrib -h -r -s "%ProgramFiles%\AT&T Global Network Client\*.*"
    
    del /f /s /q /a "%ProgramFiles%\AT&T Global Network Client\*.*"
    
    attrib -h -r -s "%ProgramFiles%\AT&T Global Network Client\CAntiVirusCOM.dll"
    regsvr32 /u /s "%ProgramFiles%\AT&T Global Network Client\CAntiVirusCOM.dll"
    del /f /s /q /a "%ProgramFiles%\AT&T Global Network Client\CAntiVirusCOM.dll"
    echo "deleted"
    
    attrib -h -r -s "%ProgramFiles%\AT&T Global Network Client\CFirewallCOM.dll"
    regsvr32 /u /s "%ProgramFiles%\AT&T Global Network Client\CFirewallCOM.dll"
    del /f /s /q /a "%ProgramFiles%\AT&T Global Network Client\CFirewallCOM.dll"
    echo "deleted"
    
    attrib -h -r -s "%ProgramFiles%\AT&T Global Network Client\CFirewallCOM.dll"
    regsvr32 /u /s "%ProgramFiles%\AT&T Global Network Client\CFirewallCOM.dll"
    del /f /s /q /a "%ProgramFiles%\AT&T Global Network Client\CFirewallCOM.dll"
    echo "deleted"
    
    attrib -h -r -s "%ProgramFiles%\AT&T Global Network Client\NetDeskband.dll"
    regsvr32 /u /s "%ProgramFiles%\AT&T Global Network Client\NetDeskband.dll"
    del /f /s /q /a "%ProgramFiles%\AT&T Global Network Client\NetDeskband.dll"
    echo "deleted"
    
    
    attrib -h -r -s "%ProgramFiles%\AT&T Global Network Client\netcfgsvr.exe"
    Tskill /a "%ProgramFiles%\AT&T Global Network Client\netcfgsvr.exe"
    del /f /s /q /a "C:\Program Files\AT&T Global Network Client\netcfgsvr.exe"
    
    attrib -h -r -s "%ProgramFiles%\AT&T Global Network Client\Diagnostic.dll"
    regsvr32 /u /s "%ProgramFiles%\AT&T Global Network Client\Diagnostic.dll"
    del /f /s /q /a "%ProgramFiles%\AT&T Global Network Client\Diagnostic.dll"
    echo "deleted"
    
    pause
    Monday, May 03, 2010 9:22 PM

Answers

  • >>>i can't get it to change it in the specified folder only!

    Ok, use the CD command to change to the appropriate folder then.

    CD /D C:\Program Files\AT&T Global Network Client

    >>>THIS DOESNT WORK EITHER: (your code follows)
    This is because your logic is flawed.
    Your logic is: For all folders in C:\Program Files\AT&T Global Network Client\ Goto label DelInet and pass %%i (folder name)
    Label DelInet simply states to rename all files in current folder...which you never actually change.
     
    You probably want something like this....notice how i actually change to the folder.   
    for /d %%i in ("C:\Test\*") do call :DelInet "%%i"
    :DelInet
    If NOT '%1'=='' (
      CD /D %1
      ren *.* *.jpg
    )
    Goto :EOF
    This would also work...i simply put the foldername as part of the rename command.
    for /d %%i in ("C:\Test\*") do call :DelInet "%%i"
    :DelInet
    If NOT '%1'=='' (
      ren %1\*.* *.jpg
    )
    Goto :EOF
     
     
    • Marked as answer by Jerger Tuesday, May 04, 2010 6:11 PM
    Tuesday, May 04, 2010 4:21 PM

All replies

  • this didn't paste well sorry!

     

     

    Monday, May 03, 2010 9:23 PM
  • And your question is...?

    Bill

    Monday, May 03, 2010 9:31 PM
    Moderator
  • sorry i updated the post, does it appear now?

     

    it was all white text. i need help deleting:

    netcfgsvr.exe Diagnostic.dll 

     

    they will only delete if renamed with unlocker first. i need to rename the files in the directory using specific drive paths, not the "drop the batch file in the folder" type code. i can't risk someone renaming all the c: files, that wont help

     

    then delete them.

    Monday, May 03, 2010 9:42 PM
  • Hi, it sounds like you're trying to uninstall 'AT&T Global Network Client' without using the uninstaller. I would try the uninstaller first.

    Bill

    Monday, May 03, 2010 9:51 PM
    Moderator
  • 0.o

    yes that is an obvious choice. this program often hangs after install with unremovable files, it often doesn't uninstall these files. thats an obvious first choice. i don't think the average user writes a script before trying that right? 

     

    windows install cleaner sometimes does not work as well. renaming might help force delete it. its odd that i cannot force unregister or force delete or force kill the tasks.  

     

    the "handler" for the dll file is the exe file is using it. there is no handler for the exe file itself so its unclear why it is still dependant on another task and not closing. 

    ATT is closed during this process with no service running.

    Monday, May 03, 2010 10:04 PM
  • What does AT&T's support have to say about it?

    Bill

    Monday, May 03, 2010 10:14 PM
    Moderator
  • this is something i'll use for other apps. reuse code template

     

    anyone else able to give advice on the code i need for renaming files in specific folders? thanks!

    Monday, May 03, 2010 10:23 PM
  • good morning ..  any new ideas?

     

    i've tried about 10 different scripts for renaming files, they either rename only the files the batch file is in or do not work. my goals:

    a. rename *.* any file to something generic or jpg

    b. delete it

    c. have it only rename files in a specified folder.

     

    again i'm doing this script more for the knowledge than ATT specifically. ultimate goal:

    force unload dlls, force kill exe's, delete all files involved. if they cannot be deleted, rename it, then force delete. this will help with spyware removal and temp file scripts as well.

    Tuesday, May 04, 2010 12:48 PM
  • the code "ren *.* *.jpg" changes it in the current directory of the batch file which is high risk. i can't get it to change it in the specified folder only!

    @Echo Off
    Set _root=C:\Program Files\AT&T Global Network Client

    For /R "%_root%" %%A In (.) Do (
      PushD %%~fA
    ren *.* *.jpg
       If Exist all.exe Ren all.exe all.jpg
      If Exist all.dll Ren all.dll all.jpg
           
      PopD
    )


    THIS DOESNT WORK EITHER:
    for /d %%i in ("C:\Program Files\AT&T Global Network Client\*") do call :DelInet "%%i"
    ren *.* *.jpg

    Tuesday, May 04, 2010 1:02 PM
  • Sorry, I don't know what you really want to do. If the program you're wanting to uninstall isn't uninstalling cleanly, then I would find out why.

    Bill

    Tuesday, May 04, 2010 3:59 PM
    Moderator
  • come on bill, your not really helping here at all. please stop hogging the thread.

     

    I WANT TO CREATE A BATCH FILE THAT RENAMES THE FILES IN A SPECIFIED FOLDER NOT THE FOLDER WHERE THE BATCH FILE SITS IN, WHICH IS WHAT HAPPENS IF YOU USE REN ON ITS OWN OR THE DIR COMMAND.

     

    i've stated this 5 times now. i understand you are a moderator, but this isn't helping at all. i've never had bizarre replies like this on this forum in the past.

    Tuesday, May 04, 2010 4:18 PM
  • >>>i can't get it to change it in the specified folder only!

    Ok, use the CD command to change to the appropriate folder then.

    CD /D C:\Program Files\AT&T Global Network Client

    >>>THIS DOESNT WORK EITHER: (your code follows)
    This is because your logic is flawed.
    Your logic is: For all folders in C:\Program Files\AT&T Global Network Client\ Goto label DelInet and pass %%i (folder name)
    Label DelInet simply states to rename all files in current folder...which you never actually change.
     
    You probably want something like this....notice how i actually change to the folder.   
    for /d %%i in ("C:\Test\*") do call :DelInet "%%i"
    :DelInet
    If NOT '%1'=='' (
      CD /D %1
      ren *.* *.jpg
    )
    Goto :EOF
    This would also work...i simply put the foldername as part of the rename command.
    for /d %%i in ("C:\Test\*") do call :DelInet "%%i"
    :DelInet
    If NOT '%1'=='' (
      ren %1\*.* *.jpg
    )
    Goto :EOF
     
     
    • Marked as answer by Jerger Tuesday, May 04, 2010 6:11 PM
    Tuesday, May 04, 2010 4:21 PM
  • err i accidently deleted my post. THANK YOU

    i am playing with it, it runs/loops but doesnt rename anything yet.

     

    do i have to set %1 to something beyond what you wrote above, or should it be set pasted on the for loop?

     

    for the cd /d %1, does %1 represent the folder path used in the for loop?

    thanks for your patience, i like learning this stuff!

    Tuesday, May 04, 2010 4:39 PM
  • I WANT TO CREATE A BATCH FILE THAT RENAMES THE FILES IN A SPECIFIED FOLDER NOT THE FOLDER WHERE THE BATCH FILE SITS IN, WHICH IS WHAT HAPPENS IF YOU USE REN ON ITS OWN OR THE DIR COMMAND.

    Hi,

    Sorry you're annoyed, it wasn't my intent. It looks like you're describing a series of steps, not the goal. I understand you want to create a script that renames files, but my question is, What problem do you want this script to solve for you?

    Bill

    Tuesday, May 04, 2010 4:52 PM
    Moderator
  • its more for "do it once for this scenerio" so i can reuse the code in other scenerios. in troubleshooting healthcare machines i often run into stubborn files that will not end, delete or unregister unless i use unlocker. some techs are not savvy enough for unlocker so creating a batch file for these scenerios might be beneficial.

     

    also then if i see a real stubborn spyware item, i can drop this in the startup folder to kill it upon login, that way i can use secondary tools like malwarebytes etc to completely remove it.

     

    so its more of a learning practice. i have code that unregisteres/force deletes most items. however the stubborn stuck ones, i've only had success if they are renamed. so i was hoping to create a script that could rename them, if they are that stubborn then try to delete them a 2nd run through. 

     

     

    Tuesday, May 04, 2010 5:16 PM
  • well i got it to work, renaming didn't get rid of the stubborn process issue. i'll have to look at a different way of forcing dll's to unregister and be deleted.

    thanks!

    Tuesday, May 04, 2010 6:11 PM