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-08-10 22:02
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Closed]Strange Things About Hiding Batch Execution in the Start-up Menu View 1,744 Replies 10
Original Poster Posted 2008-12-04 19:50 ·  中国 福建 漳州 联通
中级用户
★★
Credits 228
Posts 125
Joined 2008-08-25 19:17
17-year member
UID 124135
Gender Male
Status Offline
if "%1"=="" start mshta vbscript:CreateObject("WScript.Shell").run("%~nx0 h",0)(window.close)&&exit


This code is for hiding the running of a batch script.. I wrote a batch script.. put this batch script into the "Startup" in the start menu..
Then the computer prompts a script error every time it starts up... saying that the file is not found...

But I can run it manually directly.. really don't know where the mistake is... Could it be that the form of running at startup is different?/
Please help the experts to solve...

[ Last edited by HAT on 2008-12-5 at 13:57 ]
Floor 2 Posted 2008-12-04 20:25 ·  中国 福建 漳州 联通
中级用户
★★
Credits 228
Posts 125
Joined 2008-08-25 19:17
17-year member
UID 124135
Gender Male
Status Offline
Why is there no one coming to take a look? I'm郁闷了.
Floor 3 Posted 2008-12-04 20:29 ·  中国 江西 赣州 电信
银牌会员
★★★★
Credits 2,025
Posts 1,122
Joined 2007-09-05 20:15
18-year member
UID 96653
Gender Male
Status Offline
Try changing %~nx0 to %0
Floor 4 Posted 2008-12-04 20:50 ·  中国 福建 泉州 联通
中级用户
★★
Credits 228
Posts 125
Joined 2008-08-25 19:17
17-year member
UID 124135
Gender Male
Status Offline
Reply: Back to Brother TREE, I have tested it before, it didn't work, the same error... This problem is really frustrating.
Floor 5 Posted 2008-12-04 22:49 ·  中国 湖北 武汉 联通
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
How about trying this?
run("""%~0"" h",0)
Floor 6 Posted 2008-12-05 00:00 ·  中国 上海 杨浦区 电信
高级用户
★★★
Credits 916
Posts 377
Joined 2004-03-08 00:00
22-year member
UID 19523
Gender Male
Status Offline
It is estimated that ping will be used again for delay processing.

I have encountered this situation many times. Personally, I understand that some commands cannot be run at a certain startup moment, so ping can only be used for delay processing until entering the desktop or a certain moment to be able to run.

Previously, a batch script that used.cmd to run sc to control services could be placed to run at the computer startup stage.

Later, when packaged into an.exe file with nsi, it can only run at the user startup stage. The difference is one runs with cmd.exe and the other needs to use wscript.exe
Floor 7 Posted 2008-12-05 13:05 ·  中国 福建 漳州 联通
中级用户
★★
Credits 228
Posts 125
Joined 2008-08-25 19:17
17-year member
UID 124135
Gender Male
Status Offline
Reply to brother LXMXN.. It's no use, I've tested this method too.

Reply to the above DATO brother, I also thought so, and later I solved it. Solved it in the following way...

@echo off
if not exist "%USERPROFILE%\「Start」 Menu\Programs\Startup\hide.vbs" call :add

:loop
.............................
goto :loop

:add
echo Dim Wsh>"%USERPROFILE%\「Start」 Menu\Programs\Startup\hide.vbs"
echo Set Wsh = WScript.CreateObject("WScript.Shell")>>"%USERPROFILE%\「Start」 Menu\Programs\Startup\hide.vbs"
echo WScript.Sleep(0)>>"%USERPROFILE%\「Start」 Menu\Programs\Startup\hide.vbs"
echo Wsh.Run "C:\windows\chuli.bat",false,false>>"%USERPROFILE%\「Start」 Menu\Programs\Startup\hide.vbs"
copy /y "%~nx0" "c:\windows\">nul
start mshta vbscript:CreateObject("WScript.Shell").Run("%~NX0",0)(window.close)&&exit
goto :eof


[ Last edited by hackate on 2008-12-5 at 13:07 ]
Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
HAT +2 2008-12-05 13:55
ysc +2 2009-11-21 09:29
Floor 8 Posted 2008-12-05 19:33 ·  中国 上海 电信
初级用户
Credits 37
Posts 39
Joined 2007-12-07 22:44
18-year member
UID 105020
Gender Male
Status Offline
This post is worth collecting
Floor 9 Posted 2009-02-11 11:05 ·  中国 广东 广州 广东金万邦科技投资有限公司(新一代数据中心)IDC机房(BGP)
新手上路
Credits 3
Posts 2
Joined 2006-11-02 03:50
19-year member
UID 69249
Gender Male
Status Offline
Floor 10 Posted 2009-02-11 12:59 ·  中国 广东 东莞 电信
银牌会员
★★★
批处理编程迷
Credits 1,916
Posts 752
Joined 2008-12-28 04:30
17-year member
UID 135147
Gender Male
From 广西
Status Offline
Actually, you should directly change:

start mshta vbscript:CreateObject("WScript.Shell").Run("%~NX0",0)(window.close)&&exit

The Run("%~NX0",0) in it to:

Run("%~f0",0) or Run("%~dpnx0",0)
Is that okay?
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
5551551 +2 2009-02-21 21:34
精简
=> 个人网志
Floor 11 Posted 2009-11-19 18:25 ·  中国 四川 成都 电信
新手上路
Credits 15
Posts 12
Joined 2008-12-01 09:53
17-year member
UID 132541
Gender Male
Status Offline
Learning. In fact, DATO's statement is very practical.
Forum Jump: