中国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-09-25 15:11
47,813 topics / 349,918 posts / today 0 new / 48,274 members
DOS批处理 & 脚本技术(批处理室) » Extract the characters (files) before the first TAB position in each line of the text and copy them
Printable Version  2,374 / 29
Floor1 beyoungse Posted 2007-06-20 16:51
中级用户 Posts 112 Credits 253
myfile.txt 文本内容如下

.
.
C:\Program Files\InstallShield Installation Information\{EFB21DE7-8C19-4A88-BB28-A766E16493BC}\data1.cab 1,886KB A 2004-6-16 9:44:50

C:\Program Files\Common Files\InstallShield 1KB D 1601-1-1 8:00:00
C:\Program Files\Common Files\InstallShield\Professional 1KB D 1601-1-1 8:00:00
C:\Program Files\Common Files\InstallShield\Professional\RunTime 1KB D 1601-1-1 8:00:00
C:\Program Files\Common Files\InstallShield\Professional\RunTime\0701 1KB D 1601-1-1 8:00:00
C:\Program Files\Common Files\InstallShield\Professional\RunTime\0701\Intel32 1KB D 1601-1-1 8:00:00
C:\Program Files\Common Files\InstallShield\Professional\RunTime\0701\Intel32\ctor.dll 58KB A 2002-12-2 13:33:04

C:\Program Files\Common Files\InstallShield\Professional\RunTime\0701\Intel32\iuser.dll 156KB A 2002-12-5 14:10:32
C:\Program Files\Common Files\InstallShield\Professional\RunTime\0701\Intel32\setup.dll 283KB A 2007-6-20 19:17:16
C:\Program Files\Common Files\InstallShield\Professional\RunTime\iKernel.rgs 26KB A 2002-12-2 15:28:58
C:\Program Files\Common Files\InstallShield\Professional\RunTime\IsProBE.tlb 86KB A 2002-12-2 13:23:16
C:\Program Files\Common Files\InstallShield\Professional\RunTime\Objectps.dll 33KB A 2002-12-2 13:33:04
C:\Program Files\Common Files\Adobe\PDFL 1KB D 1601-1-1 8:00:00
C:\Program Files\Common Files\Adobe\PDFL\6.0 1KB D 1601-1-1 8:00:00
+++++++++++++++++++++++++++++++++++++++++++++++++++++
如下:
C:\Program Files\Common Files\Adobe\TypeSpt\
Unicode\Mappings\Adobe\JISX0208.txt ->D:\文件提取目录\Program Files\Common Files\Adobe\TypeSpt\
Unicode\Mappings\Adobe\JISX0208.txt

+++++++++++++++++++++++++++++++++++++++++++++++++++++

[ Last edited by beyoungse on 2007-6-20 at 09:27 PM ]
Floor2 beyoungse Posted 2007-06-20 16:52
中级用户 Posts 112 Credits 253
For example:
MSCAL.DEP 1KB A 1998-4-24
。
。
。

copy MSCAL.DEP d:\test\
Floor3 zasxcdfv Posted 2007-06-20 16:57
初级用户 Posts 75 Credits 152
对于 /f "tokens=1,*" %%a in (yourfile.txt) do copy 路径\%%a d:\test\
Floor4 beyoungse Posted 2007-06-20 17:18
中级用户 Posts 112 Credits 253
Thank you, it's okay. Studying hard.
Floor5 beyoungse Posted 2007-06-20 19:39
中级用户 Posts 112 Credits 253
C:\Program Files\Common Files\InstallShield\Professional\RunTime\iKernel.rgs 26KB A 2002-12-2 15:28:58
C:\Program Files\Common Files\InstallShield\Professional\RunTime\IsProBE.tlb 86KB A 2002-12-2 13:23:16
C:\Program Files\Common Files\InstallShield\Professional\RunTime\Objectps.dll 33KB A 2002-12-2 13:33:04
C:\Program Files\Common Files\Adobe\PDFL 1KB D 1601-1-1 8:00:00
C:\Program Files\Common Files\Adobe\PDFL\6.0 1KB D 1601-1-1 8:00:00
C:\Program Files\Common Files\Adobe\PDFL\6.0\CMaps 1KB D 1601-1-1 8:00:00
C:\Program Files\Common Files\Adobe\PDFL\6.0\CMaps\90ms-RKSJ-UCS2 113KB 2003-4-22 14:57:18
C:\Program Files\Common Files\Adobe\PDFL\6.0\CMaps\90pv-RKSJ-UCS2 2KB 2003-4-22 14:57:18
C:\Program Files\Common Files\Adobe\PDFL\6.0\CMaps\90pv-RKSJ-UCS2C 103KB 2003-4-22 14:57:18
C:\Program Files\Common Files\Adobe\PDFL\6.0\CMaps\Adobe-CNS1-B5pc 8KB 2003-4-22 14:57:18
C:\Program Files\Common Files\Adobe\PDFL\6.0\CMaps\Adobe-CNS1-ETen-B5 9KB 2003-4-22 14:57:18
C:\Program Files\Common Files\Adobe\PDFL\6.0\CMaps\Adobe-CNS1-H-CID 2KB 2003-4-22 14:57:18
C:\Program Files\Common Files\Adobe\PDFL\6.0\CMaps\Adobe-CNS1-H-Host 9KB 2003-4-22 14:57:18
C:\Program Files\Common Files\Adobe\PDFL\6.0\CMaps\Adobe-CNS1-H-Mac 8KB 2003-4-22 14:57:18
C:\Program Files\Common Files\Adobe\PDFL\6.0\CMaps\Adobe-CNS1-UCS2 262KB 2003-4-22 14:57:18
C:\Program Files\Common Files\Adobe\PDFL\6.0\CMaps\Adobe-GB1-GBK-EUC 94KB 2003-4-22 14:57:18
C:\Program Files\Common Files\Adobe\PDFL\6.0\CMaps\Adobe-GB1-GBpc-EUC 5KB 2003-4-22 14:57:18
C:\Program Files\Common Files\Adobe\PDFL\6.0\CMaps\Adobe-GB1-H-CID 2KB 2003-4-22 14:57:18
C:\Program Files\Common Files\Adobe\PDFL\6.0\CMaps\Adobe-GB1-H-Host 95KB 2003-4-22 14:57:18
C:\Program Files\Common Files\Adobe\PDFL\6.0\CMaps\Adobe-GB1-H-Mac 5KB 2003-4-22 14:57:18
C:\Program Files\Common Files\Adobe\PDFL\6.0\CMaps\Adobe-GB1-UCS2 234KB 2003-4-22 14:57:18

Copy the files of the same level in the C drive to the D drive directory and copy them together
C:\Program Files\Common Files\InstallShield\Professional\RunTime\iKernel.rgs
->D:\Program Files\Common Files\InstallShield\Professional\RunTime\iKernel.rgs
Floor6 beyoungse Posted 2007-06-20 19:57
中级用户 Posts 112 Credits 253
“C:\Program Files\Common Files\*.*"
There are two spaces in the middle, I don't know how to fix it, please help, expert!
Floor7 beyoungse Posted 2007-06-20 20:00
中级用户 Posts 112 Credits 253
How to represent the file/folder before the first TAB position
Floor8 duanml Posted 2007-06-20 20:10
中级用户 Posts 112 Credits 231
The spaces in each paragraph here are all the same length. Why not replace all the spaces in the file with <tab> symbols and then copy it into Excel so that it can be separated?

Or use the space segment as a delimiter to import into the database.

Why go to the trouble of using batch processing?
Floor9 beyoungse Posted 2007-06-20 20:19
中级用户 Posts 112 Credits 253
My purpose is to perform a copy. Save the files with the same hierarchy in the C drive to the D drive, and copy the directory as well.
C:\Program Files\Common Files\InstallShield\Professional\RunTime\iKernel.rgs
->D:\Program Files\Common Files\InstallShield\Professional\RunTime\iKernel.rgs
Floor10 duanml Posted 2007-06-20 20:28
中级用户 Posts 112 Credits 231
After exporting the target file, insert all with xcopy /e.

UltraEdit supports single-column insertion, insert xcopy in front of each column, and insert the drive letter at the back.

Or in Excel or database, add an empty column in front, put xcopy, and write the drive letter in the empty column at the back.

Finally, copy it to the bat for execution.
Floor11 duanml Posted 2007-06-20 20:31
中级用户 Posts 112 Credits 231
If you must use for, you can use delims=

Reset the replacement delimiter to that space segment~

Postscript

This method is wrong. The for in DOS does not support string as the delimiter yet.

[ Last edited by duanml on 2007-6-20 at 08:48 PM ]
Floor12 beyoungse Posted 2007-06-20 20:33
中级用户 Posts 112 Credits 253
for /f "delims=1,*" %%a in (file.txt) do xcopy /I /e/s %%a D:\

The error messages are as follows, and also "~~~~~~~~~~~ 809KB 2002-8-6 " will appear

D:\>xcopy /I /e/s C:\Program Files\Common Files\Adobe
TypeSpt\Unicode\Mappings\Win\CP949.TXT 809KB 2002-8-6 D:\
Invalid number of parameters

D:\>xcopy /I /e/s C:\Program Files\Common Files\Adobe
TypeSpt\Unicode\Mappings\Win\CP950.TXT 523KB 2002-8-6 D:\Invalid number of parameters

D:\>xcopy /I /e/s C:\WINDOWS\system32\spool\drivers\c
lor\JapanColor200 D:\File not found - JapanColor200
0 files copied

[ Last edited by beyoungse on 2007-6-20 at 08:40 PM ]
Floor13 lxmxn Posted 2007-06-20 20:39
版主 Posts 4,938 Credits 11,386
```gawk -v sign=" -F" " "BEGIN{OFS=""}/^C/{print "copy ",sign,$1,sign," ",sign,"D"substr($1,2),sign}" yourfile.ext"|more>run.bat
call run.bat

#Gawk Download
Post 9
http://www.cn-dos.net/forum/viewthread.php?tid=31098```
Floor14 duanml Posted 2007-06-20 20:46
中级用户 Posts 112 Credits 231
I made a mistake. Now the for in DOS doesn't support using strings as delimiters.

You can use the administrator's software, or the method I mentioned of separating with UltraEdit, Excel, etc., and then inserting columns.
Floor15 beyoungse Posted 2007-06-20 20:49
中级用户 Posts 112 Credits 253
It doesn't work with the class master of lxmxn either. Let's modify it again.

D:\>copy "C:\Program Files\Common Files\Adobe\TypeSpt\
Unicode\Mappings\Adobe\JISX0208.txt 107KB 2002-10-15 10:24:42
" "D:\Program Files\Common Files\Adobe\TypeSpt\Unicode\Mappings\Adobe\JISX
0208.txt 107KB 2002-10-15 10:24:42
"
The system cannot find the specified file.

Strengthen it a bit more. The target folder is in D:\File Extraction Directory\
C:\Program Files\Common Files\Adobe\TypeSpt\
Unicode\Mappings\Adobe\JISX0208.txt ->D:\File Extraction Directory\Program Files\Common Files\Adobe\TypeSpt\
Unicode\Mappings\Adobe\JISX0208.txt

[ Last edited by beyoungse on 2007-6-20 at 08:50 PM ]
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023