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-06-25 16:20
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Discussion] The Oddities in Batch Programming DigestI View 35,162 Replies 26
Floor 16 Posted 2006-01-15 01:11 ·  中国 山西 运城 移动
中级用户
★★
Credits 241
Posts 131
Joined 2005-09-28 19:01
20-year member
UID 42920
Gender Male
Status Offline
TO:willsort
There is a problem like this:
@echo off
xcopy \\computername\filename
start e:\dos\name.exe
This batch file runs without any errors!
But after converting it into .com with bat3com, the last line start e:\dos\name.exe cannot be executed!
房东说:这娃是个好孩子!
Floor 17 Posted 2006-01-15 19:48 ·  中国 山西 运城 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re maya0su:

Sorry! It has already been four years since I last used bat2com software, so I cannot be certain about the details. It may be that the command-line parameters of the start command cannot be passed correctly after being compiled by bat2com. If possible, I suggest using Call or directly calling name.exe.

Also, it should be pointed out that bat2com-type software still has major application limitations even now, such as very unsatisfactory handling of redirection and so on. Therefore I generally do not use them to compile batch files. If I had such a need, I would rather choose to use WinRAR to compress it into an executable package and set it to auto-run and auto-delete, though unfortunately if this method is used under DOS, there are still fairly large limitations.

Looking for a compression tool that can make special self-extracting archives
http://www.cn-dos.net/forum/viewthread.php?tid=15721

Self-extracting package for a batch program made with WinRAR
Attachments
CompEXE.rar (226 KiB, Credits to download 1 pts, Downloads: 116)
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 18 Posted 2007-02-08 07:05 ·  中国 北京 朝阳区 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
Good thread, enjoying it again~:)
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 19 Posted 2007-03-14 06:26 ·  中国 安徽 马鞍山 电信
中级用户
★★
Credits 493
Posts 228
Joined 2007-02-16 00:38
19-year member
UID 79596
Gender Male
From 安徽
Status Offline
Found this by accident!

Bump it up!
Floor 20 Posted 2007-03-30 06:34 ·  中国 北京 雅虎中国
中级用户
★★
菜鸟总动员
Credits 259
Posts 112
Joined 2006-08-28 15:53
19-year member
UID 61454
Status Offline
Although I haven't had time to read it carefully yet, a good thread like this definitely deserves a bump. We can't let it sink!
Floor 21 Posted 2007-04-11 00:25 ·  中国 天津 电信
初级用户
Credits 58
Posts 25
Joined 2006-11-29 13:11
19-year member
UID 72096
Gender Male
Status Offline
Now let us move on to the newer CMD@WinXP. If the directory name contains spaces, then its existence cannot be recognized by using the long filename.


Quote:
C:\>md "my test"

C:\>if not exist "my test"\nul echo Not exist "my test"
Not exist "my test"

C:\>if not exist "my test\nul" echo Not exist "my test"
Not exist "my test"

C:\>



The if command cannot be used to test a directory directly, but the null (NUL) device does in fact exist in every directory. Therefore, the existence of a directory can be determined by testing the null device. The following example can test whether a directory exists:

if exist c:mydir\nul goto process


Using the example from help, a folder with spaces in its name can be detected with a long filename, so perhaps I did not understand the senior member's topic clearly. Since I am a newbie, if there are mistakes in my reply, please forgive me!

My understanding really did have a problem. The error is:
The detection succeeds only when there is no file with the same name as the folder with spaces in it (if the file has an extension, detection also succeeds, unless that file has no extension). Otherwise it fails!

[ Last edited by logictianjin on 2007-4-11 at 01:51 PM ]
Floor 22 Posted 2007-11-10 15:00 ·  中国 广东 东莞 电信
初级用户
包身工
Credits 74
Posts 20
Joined 2007-11-07 15:52
18-year member
UID 101987
Gender Male
From 广东 东莞
Status Offline
I didn't mean to chatter here, but I really want to say, you people are truly great
Keep it up
嘘§the genius is sleeping!!!
Floor 23 Posted 2008-08-28 09:20 ·  中国 江苏 无锡 电信
新手上路
Credits 1
Posts 1
Joined 2008-08-27 17:08
17-year member
UID 124317
Gender Male
Status Offline
The DOS Union really is pretty good!
Floor 24 Posted 2010-06-26 10:17 ·  中国 四川 成都 电信
新手上路
Credits 19
Posts 20
Joined 2010-05-09 20:11
16-year member
UID 166476
Gender Male
Status Offline
Confused
Floor 25 Posted 2017-12-03 00:19 ·  中国 海南 海口 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
Bump
1<词>,2,3/段\,4{节},5(章)。
Floor 26 Posted 2020-01-12 23:14 ·  中国 广西 南宁 电信
新手上路
Credits 4
Posts 3
Joined 2019-12-25 21:25
6-year member
UID 183753
Gender Male
Status Offline
Nice one
Floor 27 Posted 2021-07-20 18:09 ·  中国 香港 Zenlayer
初级用户
Credits 21
Posts 12
Joined 2021-04-04 19:48
5-year member
UID 184434
Gender Male
Status Offline
Nice one
Forum Jump: