Looking for windows macro type software [closed]
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 questionIm 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.
精彩评论