设置路径的vbs脚本

下面这段vbs代码会将当前的目录加入到路径,同时添加一个新的环境变量,值为当前路径

Set WshShell = WScript.CreateObject(“WScript.Shell”) 
 
Set Env = WshShell.Environment(“SYSTEM”) 
 
WScript.Echo Env(“Path”) 
currentDirectory = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName)))
 
Env(“TODOR_BASE”) = currentDirectory

currentPath = Env(“Path”)
pos = InStr(currentPath,currentDirectory)
if pos=0 then
    Env(“Path”) = currentPath & “;” & currentDirectory
end if

WScript.Echo “Setup successfully!”

datamining process mindmap

批量重命名的batch

把h:abc下所有的文件加一个.rmvb的后缀
set target_dir=H:abc
@echo off
setlocal EnableDelayedExpansion
cd %target_dir%
echo %target_dir%
for /f “delims=” %%i in (‘dir /b /a-D %target_dir%’) do (
ren %%i %%i.rmvb
)
echo done!
pause