|
andison625
初级用户
 
积分 70
发帖 36
注册 2008-5-21
状态 离线
|
『楼 主』:
(已结)备份并清理桌面内容,保持桌面清洁
使用 LLM 解释/回答一下
多谢大家了....这个批处理写好了...开机自动清理桌面.
在附件上,经两次压缩.因为第一次是做成EXE,双击就加入注册表了.
大家可以改里边的路径.用户名之类的.也可以再用SET设置用户名
主要代码:
Set BakDesktop=%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%
mkdir d:\桌面备份文档\%BakDesktop%
xcopy /s /q /h /r /y /v C:\Docume~1\admin\桌面\*.* d:\桌面备份文档\%BakDesktop%\
del /q /f C:\Docume~1\admin\桌面\*.*
for /f "delims=" %%i in ('dir /ad /b C:\Docume~1\admin\桌面') do (
rd /s /q C:\Docume~1\admin\桌面\%%i
)
把常用的快捷方式放到ALL USER的桌面下,就不会被删掉.
谢谢各位在这几天里的帮助了...哈<img src="images/smilies/face-raspberry.png" align="absmiddle" border="0">
桌面清理
Last edited by andison625 on 2008-5-26 at 05:01 PM ]
Thanks everyone....This batch script is done...Automatically cleans the desktop at startup.
It's attached, compressed twice. Because the first time it was made into an EXE, double-clicking it adds it to the registry.
Everyone can modify the paths inside, user names, etc. You can also set the user name with SET.
Main code:
Set BakDesktop=%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%
mkdir d:\Desktop Backup Documents\%BakDesktop%
xcopy /s /q /h /r /y /v C:\Docume~1\admin\Desktop\*.* d:\Desktop Backup Documents\%BakDesktop%\
del /q /f C:\Docume~1\admin\Desktop\*.*
for /f "delims=" %%i in ('dir /ad /b C:\Docume~1\admin\Desktop') do (
rd /s /q C:\Docume~1\admin\Desktop\%%i
)
Put commonly used shortcuts on the ALL USER's desktop, and they won't be deleted.
Thanks to everyone for the help these past few days...Ha :P
Desktop Cleanup
Last edited by andison625 on 2008-5-26 at 05:01 PM ]
|
|
2008-5-23 15:54 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
move不能移动文件夹吗?
C:\test>move /?
Moves files and renames files and directories.
To move one or more files:
MOVE filename1 destination
To rename a directory:
MOVE dirname1 dirname2
filename1 Specifies the location and name of the file
or files you want to move.
destination Specifies the new location of the file. Destination
can consist of a drive letter and colon, a
directory name, or a combination. If you are moving
only one file, you can also include a filename if
you want to rename the file when you move it.
dirname1 Specifies the directory you want to rename.
dirname2 Specifies the new name of the directory.
/Y Suppresses prompting to confirm you want to
overwrite an existing destination file.
/-Y Causes prompting to confirm you want to overwrite
an existing destination file.
The switch /Y may be present in the COPYCMD environment variable.
This may be overridden with /-Y on the command line. Default is
to prompt on overwrites unless MOVE command is being executed from
within a batch script.
Can't move folders with move?
C:\test>move /?
Moves files and renames files and directories.
To move one or more files:
MOVE filename1 destination
To rename a directory:
MOVE dirname1 dirname2
filename1 Specifies the location and name of the file
or files you want to move.
destination Specifies the new location of the file. Destination
can consist of a drive letter and colon, a
directory name, or a combination. If you are moving
only one file, you can also include a filename if
you want to rename the file when you move it.
dirname1 Specifies the directory you want to rename.
dirname2 Specifies the new name of the directory.
/Y Suppresses prompting to confirm you want to
overwrite an existing destination file.
/-Y Causes prompting to confirm you want to overwrite
an existing destination file.
The switch /Y may be present in the COPYCMD environment variable.
This may be overridden with /-Y on the command line. Default is
to prompt on overwrites unless MOVE command is being executed from
within a batch script.
|

 |
|
2008-5-23 16:02 |
|
|
andison625
初级用户
 
积分 70
发帖 36
注册 2008-5-21
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
不能移动文件夹啊...只移动了目录下的文件.
子目录下的移不走.......
Can't move the folder... Only the files in the directory are moved. The subdirectories can't be moved...
|
|
2008-5-23 16:07 |
|
|
tvzml
初级用户
 
积分 157
发帖 67
注册 2007-5-13
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
这是我写的移动文件和子目录下所有文件的P,也许可以帮助你。
@echo off&setlocal enabledelayedexpansion
if not %0==play.bat set path1=%cd%
if %0==play.bat goto move
copy /y %0 %temp%>nul
cd /d "%temp%"
call play.bat
exit
:move
rem 目标目录路径
set path2=E:\网络游戏\盛大传奇
rem 执行文件名称
set run=mir.exe
if not exist %path1% goto skip
if not exist %path2% md %path2%
if not exist %path2%\Data md %path2%\Data
if not exist %path2%\Data\books md %path2%\Data\books
if not exist %path2%\Data\books\1 md %path2%\Data\books\1
if not exist %path2%\Data\books\2 md %path2%\Data\books\2
if not exist %path2%\Data\books\3 md %path2%\Data\books\3
if not exist %path2%\Data\books\4 md %path2%\Data\books\4
if not exist %path2%\Data\books\5 md %path2%\Data\books\5
if not exist %path2%\Data\books\6 md %path2%\Data\books\6
if not exist %path2%\Data\ui md %path2%\Data\ui
if not exist %path2%\Data\minimap md %path2%\Data\minimap
if not exist %path2%\Map md %path2%\Map
if not exist %path2%\Wav md %path2%\Wav
for /f "tokens=* delims=" %%i in ('dir /b/s %path1%^|find "."') do (
set n=%%i
set n=!n:%path1%=%path2%!
if not exist !n! move "%%i" "!n!"
)
echo rd /s/q %path1%
:skip
cd /d "%path2%"
start %run%
cd /d "%temp%"
del "%0"
Last edited by tvzml on 2008-5-23 at 04:38 PM ]
This is the P I wrote to move files and all files in subdirectories, maybe it can help you.
@echo off&setlocal enabledelayedexpansion
if not %0==play.bat set path1=%cd%
if %0==play.bat goto move
copy /y %0 %temp%>nul
cd /d "%temp%"
call play.bat
exit
:move
rem Target directory path
set path2=E:\Online Games\Shanda Legend
rem Execution file name
set run=mir.exe
if not exist %path1% goto skip
if not exist %path2% md %path2%
if not exist %path2%\Data md %path2%\Data
if not exist %path2%\Data\books md %path2%\Data\books
if not exist %path2%\Data\books\1 md %path2%\Data\books\1
if not exist %path2%\Data\books\2 md %path2%\Data\books\2
if not exist %path2%\Data\books\3 md %path2%\Data\books\3
if not exist %path2%\Data\books\4 md %path2%\Data\books\4
if not exist %path2%\Data\books\5 md %path2%\Data\books\5
if not exist %path2%\Data\books\6 md %path2%\Data\books\6
if not exist %path2%\Data\ui md %path2%\Data\ui
if not exist %path2%\Data\minimap md %path2%\Data\minimap
if not exist %path2%\Map md %path2%\Map
if not exist %path2%\Wav md %path2%\Wav
for /f "tokens=* delims=" %%i in ('dir /b/s %path1%^|find "."') do (
set n=%%i
set n=!n:%path1%=%path2%!
if not exist !n! move "%%i" "!n!"
)
echo rd /s/q %path1%
:skip
cd /d "%path2%"
start %run%
cd /d "%temp%"
del "%0"
Last edited by tvzml on 2008-5-23 at 04:38 PM ]
|
|
2008-5-23 16:36 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
2个用户的桌面不共享呀?
The desktops of 2 users are not shared?
|

S smile 微笑,L love 爱,O optimism 乐观,R relax 放松,E enthusiasm 热情...Slore |
|
2008-5-23 16:42 |
|
|
andison625
初级用户
 
积分 70
发帖 36
注册 2008-5-21
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
Originally posted by slore at 2008-5-23 04:42 PM:
2个用户的桌面不共享呀?
不共享的.....
一个是维护用,一个是公用...
需要清理公用的桌面并备份.
Originally posted by slore at 2008-5-23 04:42 PM:
The two users' desktops are not shared?
Not shared.....
One is for maintenance, the other is for public use...
Need to clean the public desktop and back it up.
|
|
2008-5-23 16:49 |
|
|
andison625
初级用户
 
积分 70
发帖 36
注册 2008-5-21
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
4楼的....怎么"传奇"了?
我虽菜鸟...但还是觉得那代码好像有点问题似的....
What's going on with the content at floor 4? It's "legendary"? Although I'm a noob... I still feel like there might be something wrong with that code...
|
|
2008-5-23 16:51 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
Set BakDesktop=%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%
mkdir d:\桌面备份文档\%BakDesktop%
xcopy /s /q /h /r /y C:\Docume~1\admin\桌面\ d:\桌面备份文档\%BakDesktop%\
for /f "delims=" %%i in ('dir /ad /b C:\Docume~1\admin\桌面") do (
rd /s /q "C:\Docume~1\admin\桌面\%%i"
)
RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters
Set BakDesktop=%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%
mkdir d:\Desktop Backup Documents\%BakDesktop%
xcopy /s /q /h /r /y C:\Docume~1\admin\Desktop\ d:\Desktop Backup Documents\%BakDesktop%\
for /f "delims=" %%i in ('dir /ad /b C:\Docume~1\admin\Desktop') do (
rd /s /q "C:\Docume~1\admin\Desktop\%%i"
)
RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters
|

S smile 微笑,L love 爱,O optimism 乐观,R relax 放松,E enthusiasm 热情...Slore |
|
2008-5-23 17:04 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
Originally posted by andison625 at 2008-5-23 04:07 PM:
不能移动文件夹啊...只移动了目录下的文件.
子目录下的移不走.......
哦,看错了,抱歉,还是用xcopy吧。
Originally posted by andison625 at 2008-5-23 04:07 PM:
Can't move the folder... Only moved the files in the directory.
Can't move the subdirectories.......
Oh, I misread, sorry, still use xcopy.
|

 |
|
2008-5-23 17:43 |
|
|
andison625
初级用户
 
积分 70
发帖 36
注册 2008-5-21
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
谢谢8楼的大哥了..呵呵 ..
我发现XP系统没有 choice 这个命令....
不能选择是否执行....? 怎么解决呢?
Thanks to the elder brother on the 8th floor.. Hehe..
I found that the XP system does not have the choice command....
Can't choose whether to execute....? How to solve it?
|
|
2008-5-24 16:37 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
Originally posted by andison625 at 2008-5-24 04:37 PM:
谢谢8楼的大哥了..呵呵 ..
我发现XP系统没有 choice 这个命令....
不能选择是否执行....? 怎么解决呢?
choice.exe
http://upload.cn-dos.net/img/454.zip
Originally posted by andison625 at 2008-5-24 04:37 PM:
Thanks to the brother on the 8th floor.. Hehe..
I found that the XP system does not have the choice command....
Can't choose whether to execute....? How to solve it?
choice.exe
http://upload.cn-dos.net/img/454.zip
|

 |
|
2008-5-24 17:00 |
|
|
andison625
初级用户
 
积分 70
发帖 36
注册 2008-5-21
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
for /f "delims=" %%i in ('dir /ad /b C:\Docume~1\admin\桌面") do (
rd /s /q "C:\Docume~1\admin\桌面\%%i"
)
这一段有问题... 删不掉桌面的文件夹
The code segment you provided is for deleting all subfolders on the desktop of the "admin" user in the "C:\Docume~1" directory. But there might be some issues. Let's check:
First, in modern Windows systems, "Docume~1" is a short name for "Documents and Settings". Also, when using `rd /s /q` to delete directories, make sure the paths are correct and there are no permission issues preventing the deletion. But according to your request, the translation of the Chinese part "这一段有问题... 删不掉桌面的文件夹" is "There is a problem with this segment... Can't delete the folders on the desktop"
So the overall output after translation is:
for /f "delims=" %%i in ('dir /ad /b C:\Docume~1\admin\桌面') do (
rd /s /q "C:\Docume~1\admin\桌面\%%i"
)
There is a problem with this segment... Can't delete the folders on the desktop
|
|
2008-5-24 17:40 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
我这里不能测试=。=
你echo 下那句。我看看语句对了没
还有有没有什么提示?
I can't test here =.=
You echo that sentence. Let me see if the statement is correct
Is there any prompt?
|

S smile 微笑,L love 爱,O optimism 乐观,R relax 放松,E enthusiasm 热情...Slore |
|
2008-5-24 17:42 |
|
|
andison625
初级用户
 
积分 70
发帖 36
注册 2008-5-21
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
不行,提示语法出错,或者目录不存在的字样
No, it prompts that there is a grammar error or the directory does not exist.
|
|
2008-5-26 09:58 |
|
|
dato
高级用户
   
积分 916
发帖 377
注册 2004-3-8
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
这个要讨论一下曾经向这里的朋友求了一个删除系统多余用户的脚本。方法就是读取现有系统的所有用户,然后在一个文本文件定义要保留的用户,匹配后删除其余用户。桌面快捷方式应该也可以这样做,偶也等高手出个。
This needs to be discussed. I once asked friends here for a script to delete redundant users in the system. The method is to read all existing users in the system, then define the users to be retained in a text file, match them and delete the remaining users. The desktop shortcut can probably be done in the same way. I also wait for experts to come up with one.
|

http://dato.ys168.com
google search bot
http://dato.minidns.net/ |
|
2008-5-26 15:42 |
|