China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-28 17:32
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Extract the characters (files) before the first TAB position in each line of the text and copy them View 2,086 Replies 29
Floor 16 Posted 2007-06-20 21:12 ·  中国 上海 电信
中级用户
★★
Credits 231
Posts 112
Joined 2007-06-19 20:44
19-year member
UID 91827
Gender Male
Status Offline
Do you have UltraEdit installed?

First, copy the mixed directory files and attribute times in, and replace the space segments used to separate the contents with <tab> characters.

Then copy the content into Excel, and Excel will place the directory files and attribute times in different columns according to the <tab> delimiter.

Then add an empty column in front of the directory file column, insert xcopy, and replace the column after the directory file column with the target directory and /e.

After that, copy them all into a bat file together.
Floor 17 Posted 2007-06-20 21:13 ·  中国 广东 深圳 福田区 电信
中级用户
★★
Credits 253
Posts 112
Joined 2005-12-20 00:31
20-year member
UID 47500
Status Offline
I'll try installing UltraEdit. Thanks for your attention
Floor 18 Posted 2007-06-20 21:49 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
I followed the file you provided for testing and it works. I don't know why you can't.
Floor 19 Posted 2007-06-20 21:52 ·  中国 广东 深圳 福田区 电信
中级用户
★★
Credits 253
Posts 112
Joined 2005-12-20 00:31
20-year member
UID 47500
Status Offline
Generated run.bat
copy "C:\Documents and Settings\All Users\「Start」Menu\Programs\Adobe ImageReady CS.lnk 1KB A 2007-6-20 19:19:52 " "D:\Documents and Settings\All Users\「Start」Menu\Programs\Adobe ImageReady CS.lnk 1KB A 2007-6-20 19:19:52 "
copy "C:\Documents and Settings\All Users\「Start」Menu\Programs\Adobe Photoshop CS.lnk 1KB A 2007-6-20 19:19:52 " "D:\Documents and Settings\All Users\「Start」Menu\Programs\Adobe Photoshop CS.lnk 1KB A 2007-6-20 19:19:52 "
copy "C:\Documents and Settings\All Users\「Start」Menu\Programs\Startup\Adobe Gamma Loader.lnk 2KB A 2007-6-20 19:19:52
.
.
.
..
Floor 20 Posted 2007-06-20 21:54 ·  中国 广东 深圳 福田区 电信
中级用户
★★
Credits 253
Posts 112
Joined 2005-12-20 00:31
20-year member
UID 47500
Status Offline
I need to add quotes to the values in each cell in EXCEL. How can I add quotes to the values in a column?
Floor 21 Posted 2007-06-20 21:59 ·  中国 上海 电信
中级用户
★★
Credits 231
Posts 112
Joined 2007-06-19 20:44
19-year member
UID 91827
Gender Male
Status Offline
Then add a column before and after the directory file list, add quotes in it, and then copy back to UltraEdit, use column mode to delete the excess <tab> symbols.
Floor 22 Posted 2007-06-20 22:06 ·  中国 广东 深圳 福田区 电信
中级用户
★★
Credits 253
Posts 112
Joined 2005-12-20 00:31
20-year member
UID 47500
Status Offline
Well, I tried, but there are still some problems. When copying *.lnk, it prompts whether it's a file or a directory? You need to add \ after each directory.
Floor 23 Posted 2007-06-20 22:51 ·  中国 广东 深圳 福田区 电信
中级用户
★★
Credits 253
Posts 112
Joined 2005-12-20 00:31
20-year member
UID 47500
Status Offline
It's okay to save the file as TXT using EXCEL, but there's still one problem. As follows:

xcopy /e "C:\Program Files\Common Files\InstallShield\Professional" "D:\Target Files\Program Files\Common Files\InstallShield\Professional"
xcopy /e "C:\Program Files\Common Files\InstallShield\Professional\RunTime" "D:\Target Files\Program Files\Common Files\InstallShield\Professional\RunTime"
xcopy /e "C:\Program Files\Common Files\InstallShield\Professional\RunTime\0701" "D:\Target Files\Program Files\Common Files\InstallShield\Professional\RunTime\0701"
xcopy /e "C:\Program Files\Common Files\InstallShield\Professional\RunTime\0701\Intel32" "D:\Target Files\Program Files\Common Files\InstallShield\Professional\RunTime\0701\Intel32"
xcopy /e "C:\Program Files\Common Files\InstallShield\Professional\RunTime\0701\Intel32\ctor.dll" "D:\Target Files\Program Files\Common Files\InstallShield\Professional\RunTime\0701\Intel32\ctor.dll"
xcopy /e "C:\Program Files\Common Files\InstallShield\Professional\RunTime\0701\Intel32\DotNetInstaller.exe" "D:\Target Files\Program Files\Common Files\InstallShield\Professional\RunTime\0701\Intel32\DotNetInstaller.exe"

When copying the first directory, it will copy all the files under the directory to the directory folder. When it's a directory, it's required to only create the directory, and when it's a file, it's only to copy the single file
Floor 24 Posted 2007-06-20 23:08 ·  中国 上海 电信
中级用户
★★
Credits 231
Posts 112
Joined 2007-06-19 20:44
19-year member
UID 91827
Gender Male
Status Offline
There is a column in your file that shows attributes. When you first copy it into Excel, sort by attributes, pick out the D attribute and handle it separately from the file.

xcopy /t /e directory target
It won't copy the files.
Floor 25 Posted 2007-06-21 00:47 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Please upload your file as an attachment, and I'll test it.
Floor 26 Posted 2007-06-26 15:30 ·  中国 广东 深圳 龙岗区 电信
中级用户
★★
Credits 253
Posts 112
Joined 2005-12-20 00:31
20-year member
UID 47500
Status Offline
I was occupied with other things the past two days, sorry. The original file is in the attachment.
Attachments
changefiles.txt (3.82 KiB, Downloads: 9)
Floor 27 Posted 2007-06-27 12:23 ·  中国 四川 攀枝花 电信
新手上路
Credits 6
Posts 3
Joined 2007-02-08 11:20
19-year member
UID 78981
Gender Male
Status Offline
for /f "usebackq delims== " %%i in (h:\cp.txt) do (mkdir e:\1"%%~pi")&(copy "%%i" e:\1"%%~pi")
Floor 28 Posted 2007-07-09 19:50 ·  中国 广东 东莞 电信
中级用户
★★
Credits 253
Posts 112
Joined 2005-12-20 00:31
20-year member
UID 47500
Status Offline
There will still be redundant things upstairs. (mkdir "directory") & (copy "C:\"directory"\data1.cab 1,886KB A 2004-6-16 9:44:50" "directory")
Floor 29 Posted 2007-07-09 21:03 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
RE beyoungse:

I tested again, the one on my 13th floor is okay, change yourfile.txt to your changfiles.txt file.
Floor 30 Posted 2007-07-09 22:17 ·  中国 广东 东莞 电信
中级用户
★★
Credits 253
Posts 112
Joined 2005-12-20 00:31
20-year member
UID 47500
Status Offline
Thank you. I tested with XP XP2 and it works.

[ Last edited by beyoungse on 2007-7-9 at 10:28 PM ]
Forum Jump: