CMD: Filename or extension is too long
#1
Posted 16 September 2012 - 12:23 PM
Thanks
#2
Posted 16 September 2012 - 06:37 PM
Cheers and Regards
#3
Posted 16 September 2012 - 07:14 PM
@ECHO OFF
ECHO=_%~1|FINDSTR/X "_-123456 _/123456">NUL 2>&1||GOTO Error
SETLOCAL ENABLEEXTENSIONS
SET "_="
PUSHD %~dp0
FOR /R %%A IN (Windows*-KB*.EXE) DO (
SET _=T
ECHO= Installation of %%~nA...
>NUL PING -n 4 127.0.0.1
"%%A" /quiet /norestart)
IF NOT DEFINED _ GOTO Error
ECHO=
ECHO= == Press any key to restart. ==
>NUL PAUSE
SHUTDOWN.EXE /r /t 0
GOTO :EOF
:Error
ECHO= Error.
ECHO=
ECHO= Press any key to exit...
>NUL PAUSE
My batch repeats the central part several times to install other software:
FOR /R %%A IN (Windows*-KB*.EXE) DO (
SET _=T
ECHO= Installation of %%~nA...
>NUL PING -n 4 127.0.0.1
"%%A" /quiet /norestart)
Converting it into a single line batch, results too long to execute for CMD.exe. Is there a solution to this limitation?
Thank you
This post has been edited by Caml Light: 16 September 2012 - 07:16 PM
#4
Posted 16 September 2012 - 09:03 PM
Cheers and Regards
#5
Posted 16 September 2012 - 09:45 PM
Thank you
This post has been edited by Caml Light: 16 September 2012 - 10:00 PM
#6
Posted 16 September 2012 - 10:13 PM
Cheers and Regards
#7
Posted 16 September 2012 - 11:05 PM
@ECHO OFF & cmd /k start /b powershell -command "clear-host;[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic');$INDEX = [Microsoft.VisualBasic.Interaction]::InputBox('Enter Image #', 'Which image to mount', '1');$PROMPT = [Microsoft.VisualBasic.Interaction]::MsgBox('Ready to mount image ?', 'OKCancel,Question', 'Last Chance to Cancel');switch ($PROMPT) {'OK'{Dism /mount-wim /wimfile:D:\sources\boot.wim /index:$INDEX /mountdir:C:\zMountDir}'Cancel'{exit}}" & PAUSE
On second thought, your script looks short but that %%A variable expands at runtime, the problem could be the expanded 'path' length being more than 256 characters, why not convert the %%A variable to 8.3 short naming before it loops.
Alternatively try encrypting your batch as an exe. Plenty of free-wares offer that agility.
This post has been edited by MrJinje: 16 September 2012 - 11:34 PM
#8
Posted 16 September 2012 - 11:13 PM
Anyway if you need the loop part, this might work:
FOR /R %A IN (Windows*-KB*.EXE) DO ( SET _=T && ECHO= Installation of %~nA... && PING -n 4 127.0.0.1 >NUL && "%A" /quiet /norestart)
#9
Posted 16 September 2012 - 11:36 PM
MrJinje, on 16 September 2012 - 11:05 PM, said:
@ECHO OFF & cmd /k start /b powershell -command "clear-host;[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic');$INDEX = [Microsoft.VisualBasic.Interaction]::InputBox('Enter Image #', 'Which image to mount', '1');$PROMPT = [Microsoft.VisualBasic.Interaction]::MsgBox('Ready to mount image ?', 'OKCancel,Question', 'Last Chance to Cancel');switch ($PROMPT) {'OK'{Dism /mount-wim /wimfile:D:\sources\boot.wim /index:$INDEX /mountdir:C:\zMountDir}'Cancel'{exit}}" & PAUSE
On second thought, your script looks short but that %%A variable expands at runtime, the problem could be the expanded 'path' length being more than 256 characters, why not convert the %%A variable to 8.3 short naming before it loops.
Alternatively try encrypting your batch as an exe. Plenty of free-wares offer that agility.
I've already bought (paid version) a well-known batch compiler program, but it extracts the batch into the %TEMP% folder, so it's useless.
allen2, on 16 September 2012 - 11:13 PM, said:
Anyway if you need the loop part, this might work:
FOR /R %A IN (Windows*-KB*.EXE) DO ( SET _=T && ECHO= Installation of %~nA... && PING -n 4 127.0.0.1 >NUL && "%A" /quiet /norestart)
Do you know Multimedia Builder? I use that program. Anyway, my batch is very long, and with MMB i must create several Run("CMD","parameter$") commands (very bad), so i've choice to do it with a single Run command unifying the whole batch into a single line. But for CMD.exe that line is too long.
#10
Posted 16 September 2012 - 11:54 PM
#11
Posted 16 September 2012 - 11:57 PM
allen2, on 16 September 2012 - 11:54 PM, said:
i use the program from some years, but i don't know how it could be possible to convert a batch into a MMB script.
EDIT: You've a PM
This post has been edited by Caml Light: 17 September 2012 - 12:05 AM
#12
Posted 17 September 2012 - 03:05 AM
Caml Light, on 16 September 2012 - 09:45 PM, said:
You must have missed this before buying that (whatever it is) batch "compiler":
http://www.robvander...ptcompilers.php
jaclaz
#13
Posted 17 September 2012 - 02:30 PM
#14
Posted 18 September 2012 - 03:21 PM
Yzöwl, on 17 September 2012 - 02:30 PM, said:
Because everyone can access to that folder and get the batch. I wish to hide the batch file. The world is big, not all people are skillful as you or other members of this community.
Anyway, for a UNskillful person, the %TEMP% folder is easy to get.
This post has been edited by Caml Light: 18 September 2012 - 03:23 PM
#15
Posted 19 September 2012 - 01:38 AM
Caml Light, on 18 September 2012 - 03:21 PM, said:
Yzöwl, on 17 September 2012 - 02:30 PM, said:
Because everyone can access to that folder and get the batch. I wish to hide the batch file. The world is big, not all people are skillful as you or other members of this community.
Anyway, for a UNskillful person, the %TEMP% folder is easy to get.
I guess the thing we are not understanding is why is it important to hide this batch that is being used to install updates? So what if an UNskillful person can get to the %TEMP% folder? What are you afraid that they will do with this non secret information? What is the big deal? For that matter, why hide it at all?
Cheers and Regards
#16
Posted 19 September 2012 - 02:12 AM
This post has been edited by MrJinje: 19 September 2012 - 02:23 AM
#17
Posted 19 September 2012 - 02:30 AM
MrJinje, on 19 September 2012 - 02:12 AM, said:
CMD batch or converted to a different language?
I'm enthusiast about security, and i want to learn, to learn, to learn, this is the way for me! I'm curious if exists a way to don't decompile in the the HD. I know that is possible to do what you wrote with VBScript, not with a CMD batch.
This post has been edited by Caml Light: 19 September 2012 - 02:59 AM
#18
Posted 19 September 2012 - 09:25 AM
ExeScript
Quote
To protect your scripts against unauthorized use, ExeScript can set a password to run, making it impossible to launch a script without knowing the right password. Secure AES encryption and password-protection make converted BAT to exe, VBS to exe files secure for wide distribution.
#19
Posted 19 September 2012 - 10:34 AM
Caml Light, on 18 September 2012 - 03:21 PM, said:
Wouldn't it be protected by Copyright Laws?
In any case you could have people to which you provide the install routine to sign a NDA:
http://en.wikipedia....osure_agreement
You know, just to be on the safe side.
jaclaz
#20
Posted 19 September 2012 - 11:34 AM
I also noted that you did not answer my previous questions. I can understand that you "want to learn, to learn, to learn", but what exactly are you wanting to learn and for what purpose?
Cheers and Regards



Help

Back to top









