中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-12 15:10
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » Experts, please help look at this batch file for an undeletable folder
Printable Version  4,962 / 46
Floor1 philon Posted 2008-06-25 00:40
初级用户 Posts 19 Credits 42
I want to put this batch file into any directory I need. After running it, it should create an undeletable folder named sm. in that directory, and copy all files and folders in that directory into the undeletable folder sm.. With copy I can only copy files, not folders. How should I handle it with xcopy? Please give me some pointers, experts! The contents are as follows:

@echo off&mode con cols=50 lines=12
title Create or delete a private folder
if not exist sm..\nul (
md sm..\
color 5a&cls&echo.&echo The private folder has been created! Files will be put into the private folder...&ping/n 2 127.1>nul
echo Copying files...
copy %CurDir% * sm..\>nul 2>nul
) else (
rd /s/q sm..\
color 5e&cls&echo.&echo The private folder has been deleted!&ping/n 2 127.1>nul
)
color 5b&cls&echo.&echo Run it again to recreate or delete!&ping/n 2 127.1>nul
Floor2 pusofalse Posted 2008-06-25 00:44
银牌会员 Posts 646 Credits 1,604
I'm not interested in weird folders.
Can't help you...
Just helping bump the thread...
But you can use the "folder extension" trick to hide your stuff in c:\windows\tasks. Be sure to use the copy command, otherwise the graphical interface won't work...
Also places like the browser, Control Panel, My Network Places, Administrative Tools, and Recycle Bin are all good places to hide files....
Floor3 philon Posted 2008-06-25 01:01
初级用户 Posts 19 Credits 42
I also posted on the VeryBatch forum and nobody solved it there either, depressing!!
Floor4 HAT Posted 2008-06-25 01:04
版主 Posts 5,017 Credits 9,023
xcopy probably can't copy things into a weird folder
OP isn't from the national nuclear submarine training center, is he

Credits 4
Posts 1
Registered 2005-12-23
Status Online
Floor5 PPdos Posted 2008-06-25 01:20
高级用户 Posts 268 Credits 783
Lurking for three years without showing up, huh. A rare talent, a rare talent!
Floor6 philon Posted 2008-06-25 01:21
初级用户 Posts 19 Credits 42
Hahahaha, brother hat, you're making fun of me. True indeed!
Floor7 jsunhj Posted 2008-06-25 12:04
贫困用户 Posts 11 Credits -5
Don't understand it, just bumping
Floor8 wxcute Posted 2008-06-25 21:45
中级用户 Posts 211 Credits 458
xcopy doesn't handle the current directory very well like this.
If the dotted directory isn't under the current directory, it'll be easier.
Floor9 yxn064 Posted 2008-06-26 16:14
新手上路 Posts 9 Credits 16
You really are an expert to write such a complicated command!
Floor10 philon Posted 2008-06-27 11:07
初级用户 Posts 19 Credits 42
Still nobody can solve it?
Floor11 amio Posted 2008-06-27 11:23
中级用户 Posts 93 Credits 206
Why not just directly create a folder you want to copy? Then copy all the files under that folder into the folder you just created ??
Floor12 wingface Posted 2008-06-27 11:44
新手上路 Posts 2 Credits 12
copy %CurDir% * sm6b7e~1>nul 2>nul

Don't ask me why, use dir /x yourself and you'll know
Floor13 HAT Posted 2008-06-27 11:58
版主 Posts 5,017 Credits 9,023
Originally posted by wingface at 2008-6-27 11:44 AM:
copy %CurDir% * sm6b7e~1>nul 2>nul

Don't ask me why, use dir /x yourself and you'll know

Nice job!
Floor14 moniuming Posted 2008-06-27 19:18
银牌会员 Posts 574 Credits 1,335 From 广西
@echo off
for /l %%a in (1 1 10000) do set "n=%%a"
echo After %n% tests, I found that xcopy and move cannot operate on weird directories
pause>nul
Floor15 HAT Posted 2008-06-27 20:27
版主 Posts 5,017 Credits 9,023
Using the method in post #12, xcopy can operate on weird directories
1 2 3 4  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023