开发者

Looking for windows macro type software [closed]

开发者 https://www.devze.com 2023-04-03 17:13 出处:网络
Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it ca开发者_JAVA百科n be answered with facts and citations.

Closed 8 years ago.

Improve this question

Im looking for something that will allow me to perform simple batch-type automation in the Win XP operating system.

I need to, for example, pre-pend the name of every folder a file is nested in to it's filename.

So, before: blah\yep\dave\robert.txt after: blah\yep\dave\blah_yep_dave_robert.txt

I would also like to change all the files to read-only mode.

I used to have a tool that did this but I forgot its name.


This can be done with a batch file:

@echo off
setlocal enableextensions enabledelayedexpansion
set PathSegmentToIgnore=%~dp0
for /r %%F in (*) do (
  if not exist %%F\NUL if not "%%~F"=="%~dpnx0" (
    rem ignore folders
    set "FilePath=%%~dpF"
    set "FilePath=!FilePath:%PathSegmentToIgnore%=!"
    set "FilePath=!FilePath!%%~nxF"
    set "FilePath=!FilePath:\=_!"
    echo Renaming "%%~nxF" to "!FilePath!"
    move "%%~F" "%%~dpF!FilePath!" >nul 2>&1
  )
)


Use VBScript or Powershell. Both are good options for scripting.

0

精彩评论

暂无评论...
验证码 换一张
取 消