中国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-15 13:32
47,812 topics / 349,917 posts / today 0 new / 48,268 members
DOS批处理 & 脚本技术(批处理室) » How to create a new batch file?
Printable Version  1,465 / 13
Floor1 qingfushuan Posted 2007-02-25 02:27
高级用户 Posts 327 Credits 502
Been lurking for a long time, post a new thread to ask

Everyone, what do you use to create a new batch file?

For example: right-click
@echo off
reg add HKCR\.bat\ShellNew /v nullfile /f
reg add HKCR\batfile /v e /d p /f

I counted, need right-click (new p) - left-click (click) - rename (keyboard) - right-click (edit) - left-click (click)

Oh my god, have to click the mouse 4 times, and also right-left-right-left, it's very troublesome, and then have to (@echo off) -- have to type 8 characters on the keyboard, a space,

Is there a faster way, preferably double-click to be okay?

[ Last edited by qingfushuan on 2007-2-24 at 01:29 PM ]
Floor2 qasa Posted 2007-02-25 02:47
高级用户 Posts 311 Credits 959 From 广东-LianJiang
I was a bit stunned when I saw the thread started by the LZ.
How come the LZ is also a medium-level user, why still post such a thread...
It's not strange if a newbie asks, but speechless...
Floor3 qingfushuan Posted 2007-02-25 02:52
高级用户 Posts 327 Credits 502
Spent 2 hours to the water area and got 300 points, heh
Floor4 everest79 Posted 2007-02-25 03:19
金牌会员 Posts 1,127 Credits 2,564
```
SET TL="%userprofile%\Templates\sscript.cmd"
ECHO @ECHO OFF>%TL%
ECHO ::SETLOCAL ENABLEDELAYEDEXPANSION>>%TL%
ECHO.>>%TL%
ECHO EXIT>>%TL%
REG ADD "HKEY_CLASSES_ROOT\.cmd\shellnew" /v filename /d sscript.cmd /f
```
Floor5 slore Posted 2007-02-25 04:08
铂金会员 Posts 2,478 Credits 5,212
Oh, dizzy~ When you right-click to create a new one, it automatically comes out without having to click the left button.

Then here you go~ Just wrote this.

Extract to any folder (haven't tested if there are spaces~ I just put it on drive D).

2 files:

Crbat.cmd:


Register Crbat.bat:


First run the register Crbat.bat, you refresh the new twice, and you can see a Creat Bat file type, you create a new one, then double-click it.

Attachments
4bat.rar (457 bytes)
Floor6 slore Posted 2007-02-25 04:13
铂金会员 Posts 2,478 Credits 5,212
The one on the 4th floor is good! Forgot the filename.
Floor7 qingfushuan Posted 2007-02-25 06:34
高级用户 Posts 327 Credits 502
When I came to the union, I always used it. Create a new text file - rename it to XXX.bat - edit - @echo off, it's so troublesome.

Fortunately, I found the.bat in the right - click. The fifth sentence in the registration of.bat by the friend on the fifth floor is wrong:

reg add HKCR\Crbatfile\shell\open\command /ve /d %cd%\Crbat.cmd" \"%%1\"" /f

Error: too many command - line arguments

Crbat.cmd is okay. Can it be lazier? Can the cursor blink on the second line
Floor8 everest79 Posted 2007-02-25 06:46
金牌会员 Posts 1,127 Credits 2,564
I've always been using the method you've been using. This newly created script is based on imitating the MS-HTML document creation method as you requested
Floor9 slore Posted 2007-02-25 06:49
铂金会员 Posts 2,478 Credits 5,212
D:\4bat>reg add HKCR\.Crbat\ShellNew /v NullFile /f

The operation completed successfully.

D:\4bat>reg add HKCR\Crbatfile /ve /d Creat" Bat" /f

The operation completed successfully.

D:\4bat>reg add HKCR\Crbatfile\DefaultIcon /ve /d C:\WINDOWS\system32\cmd.exe,0
/f

The operation completed successfully.

D:\4bat>reg add HKCR\Crbatfile\shell /ve /d open /f

The operation completed successfully.

D:\4bat>reg add HKCR\Crbatfile\shell\open\command /ve /d D:\4bat\Crbat.cmd" \"%
1\"" /f

The operation completed successfully.

You have a space in the path...
Floor10 zch1366 Posted 2007-02-25 21:50
中级用户 Posts 148 Credits 326
Floor11 qingfushuan Posted 2007-02-26 00:54
高级用户 Posts 327 Credits 502
Crbat.cmd is okay. Can you be lazier? Can the cursor flash on the second line so that I don't have to press the ↓ key again
Floor12 slore Posted 2007-02-26 02:58
铂金会员 Posts 2,478 Credits 5,212
Then either don't use P, use a script. After opening, send a key press =. = Are you too lazy?
Floor13 qingfushuan Posted 2007-02-26 05:50
高级用户 Posts 327 Credits 502
Batch processing was originally invented to reduce workload = for the lazy
Floor14 6622186 Posted 2007-03-14 01:43
高级用户 Posts 411 Credits 894
You can also use the copy command

copy nul file.bat
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023