Board logo

标题: 请教:备份windows个人用户数据脚本 [打印本页]

作者: hooven     时间: 2007-10-16 16:57    标题: 请教:备份windows个人用户数据脚本

C:\Documents and Settings 下有很多用户的个人文件,

现在想利用脚本遍历 C:\Documents and Settings 下的所有用户文件夹,
如果其中存在 '桌面' '收藏夹' 'Favorites' 'My Documents' 这些文件夹,则将它们复制备份到 D:\bak目录下。

如将:   C:\Documents and Settings\admin\Favorites
备份至:D:\bak\admin\Favorites

请问该如何做?谢谢
作者: hooven     时间: 2007-10-16 19:51
现在我用
for /f %%a in ('dir /b/ad "C:\Documents and Settings\"') do (
echo user = %%a
)
all users目录
%%a 得到的是 all
得不到all user

有什么办法可以得到all user 的结果么?
作者: lxmxn     时间: 2007-10-17 02:21
for /f "tokens=*" %%a in ...
作者: HAT     时间: 2007-10-17 10:43
all users目录和current user目录可以直接使用系统默认的变量:

echo %allusersprofile%
echo %userprofile%