sfk replace error when replacing text in Desktop.ini system files

  • Roger Sillito

    Roger Sillito - 2014-02-21

    I'm trying to replace some paths within all Desktop.ini files on a drive in Windows 7 (many of these are hidden files). If I try this:

    sfk replace -text "#\COMPUTERNAME\My Documents\My Pictures#%_ToolsDir%_#" -dir . -file Desktop.ini -hidden -yes

    I get "error: cannot rewrite file: DevFiles\Desktop.ini" for each search hit. But if I do a smaller search/replace pattern, e.g.

    sfk replace -text "#COMPUTERNAME#JAMES#" -dir . -file Desktop.ini -hidden -yes

    it works. Can you help?

  • stahlworks

    stahlworks - 2014-02-22

    it looks like there is a typo in your command. Please check


    if it shouldn't be


    maybe the problem lies not within argument length but the slash \ being modified by the environment, or in the way that the ToolsDir variable was set. try to expand the command to what is actually done by

    echo "#\COMPUTERNAME\My Documents\My Pictures#%_ToolsDir_%#"

    and then compare, any maybe post here, the fully expanded commands.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks