DEL not works

Discussion in 'Scripting' started by Ufuk_26, Dec 23, 2016.

  1. Ufuk_26

    Ufuk_26 MDL Novice

    Apr 6, 2015
    4
    0
    0
    #1 Ufuk_26, Dec 23, 2016
    Last edited by a moderator: Apr 20, 2017
    Hi i create batch script.
    I start batch file from usb disk etc ...
    But doesn't work del function in Windows 7 etc...

    Code:
    c:
    cd..
    cd..
    cd %ProgramFiles%
    cd LSOFTT~1
    cd ACTIVE~1
    del SETTINGS.INI /Q /S
    @ECHO.
    @PAUSE
    
    del %ProgramFiles%\LSOFTT~1\ACTIVE~1\SETTINGS.INI /Q /S
    @ECHO.
    @PAUSE
    
    del "%ProgramFiles%\LSOFTT~1\ACTIVE~1\SETTINGS.INI" /Q /S
    @ECHO.
    @PAUSE
    
    del "Program Files"\LSOFTT~1\ACTIVE~1\SETTINGS.INI /Q /S
    @ECHO.
    @PAUSE
    
    del C:\PROGRA~2\LSOFTT~1\ACTIVE~1\SETTINGS.INI /Q /S
    @ECHO.
    @PAUSE
    
    
    I need help. thanks
     
  2. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,524
    652
    60
    #2 Flipp3r, Dec 23, 2016
    Last edited by a moderator: Apr 20, 2017
    Is "LSOFTT~1" the full folder name? That looks like what you'd see in dos.
    Also, is the path "%programfiles%" or "%ProgramFiles(x86)%"?
    Use the full path, ie:
    Code:
    cd /d "%ProgramFiles%\lsoft tech\active whatever"
    del settings.ini /q /s
    Since this is running in the system folder you may need to run the batch as admin as well...
     
  3. Ufuk_26

    Ufuk_26 MDL Novice

    Apr 6, 2015
    4
    0
    0
    not work :)

    i have this error: is not recognized as an internal or external command, operable program or batch file

    Target File: C:\Program Files\LSoft Technologies\Active@ Data Studio\Settings.ini

    i try with all ways.
     
  4. Compo

    Compo MDL Member

    Mar 29, 2011
    137
    103
    10
    #4 Compo, Jan 4, 2017
    Last edited by a moderator: Apr 20, 2017
    This is all you need, there should be no reason to use 8.3 naming.
    Code:
    @Del "%ProgramFiles%\LSoft Technologies\Active@ Data Studio\Settings.ini">Nul 2>&1
    Running this as administrator will ensure that you have permissions to remove the file.
     
  5. TairikuOkami

    TairikuOkami MDL Addicted

    Mar 15, 2014
    663
    510
    30
    del "%ProgramFiles(x86)%\LSoft Technologies\Active@ Data Studio\Settings.ini" /s /f /q

    But you might need to take ownership, since it is located in a protected folder. Not sure, if it works in 7 though.

    takeown /f "%ProgramFiles(x86)%\LSoft Technologies\Active@ Data Studio\Settings.ini" /a
    icacls "%ProgramFiles(x86)%\LSoft Technologies\Active@ Data Studio\Settings.ini" /grant:r Administrators:F /c
    del "%ProgramFiles(x86)%\LSoft Technologies\Active@ Data Studio\Settings.ini" /s /f /q