|
From the News Page 7 | |
LNK -- How to create "EXE Shortcut" (LNK files) in Win9X.
;-)
LINK.BAT
The danger WEB (Updated April 30 after the ZIP file was uploaded)
MultiClip.bat Get a nice Multi Clipboard in the TEMP environment.
Get shorter names.
Echo on/off A DOS-Batch Programmer's Template.
Most About VBS and Date .
LNK
@Goto Start
How to create Shortcut (LNK files) in Win9X.
Unless MS = idiots, then the below batch file should works in
WinME/NT/2000/XP and... but I have only tested in Win98.
It takes 3 parameters:
1. A link name,
2. An EXE file
3. A folder name to put the link.
The LNK file is placed in a folder named something like this:
Start Menu \ Programs \ {t e m p}
then the created LNK file is moved to the put-folder (%3) and
the {t e m p} folder is deleted.
This two lines:
1) call %0 - - - - goto _path(1)
2) for %%c in (call del) do %%c %temp%.\_path.bat
is used to get the name of the "Start Menu\program" folder.
How:
The "call %0 - - - - goto _path(1)" will create a batch file
named _path.bat with a contents of something like this:
"Programs"="C:\\WINDOWS\\Menuen Start\\Programmer"
which is transformed to:
path="C:\\WINDOWS\\Menuen Start\\Programmer"
A file named BSlshLst.bat (Back Slash List) is created
to contents information about where the Back Slash are placed:
:: 0123456789abcdef0123456789abcdef0123456789a
XXXX:010E \\ \\ \\
XXXX:010F
XXXX:0117
XXXX:0118
XXXX:0125
XXXX:0126 Which is transformed to something like this:
%1 010E 010F
0F8C:0117
0F8C:0118
0F8C:0125
0F8C:0126 A "call BSlshLst.bat %0" will so return
the first two locations of
Back Slash: 010E and 010F as %1 and %2.
path="C:\WINDOWS\\Menuen Start\\Programmer"
\ \\ \\
and so on... until all the "\\" is substituted with "\",
path="C:\WINDOWS\Menuen Start\Programmer"
The second line:
2) for %%c in (call del) do %%c %temp%.\_path.bat
does:
set path=C:\WINDOWS\MENUEN~1\PROGRA~1
Benny Pedersen,
PS. The two lines explained above is prefixed with 5 spaces below.
BTW. A long line is broken, must be unwrapped, see label :_path(1).
:Start (excluding this label).
@if exist %temp%.\_path.bat goto _path(2)
::
@%5 %6 echo off %[1. Link name:] [2. Link to below exe:] [3. Link put:]%
if ()==(%3) %0 "Sound Shortcut" "%windir%\SNDVOL32.EXE" "c:\many games"
::
if not exist %3\NUL for %%c in (ech got) do %%co:ÿ Not found folder %3\
if not exist %2 for %%c in (ech got) do %%co:ÿ No such .EXE file %2
if exist %3\%1.LNK for %%c in (ech got) do %%co:ÿ File exist %3\%1.LNK
echo> %temp%.\~t.inf [version]
echo>>%temp%.\~t.inf signature="$chicago$"
echo>>%temp%.\~t.inf [DefaultInstall]
echo>>%temp%.\~t.inf UpdateInis=Addlink
echo>>%temp%.\~t.inf [AddLink]
echo>>%temp%.\~t.inf setup.ini,progman.groups,,"group0={t e m p}"
echo>>%temp%.\~t.inf setup.ini,group0,,""{t e m p}""
echo>>%temp%.\~t.inf setup.ini,group0,,""%1","%2",,0,"
set cmdline=InstallHinfSection DefaultInstall
start /wait rundll.exe setupx.dll,%cmdline% 132 %temp%.\~t.inf
erase %temp%.\~t.inf
call %0 - - - - goto _path(1)
for %%c in (call del) do %%c %temp%.\_path.bat
for %%1 in (%1) do %windir%\command\move "%path%\{t e m p}\%%1.lnk" %3>nul
rd "%path%\{t e m p}"
for %%c in (%windir%\explorer goto:ÿ cls) do %%c %3
:: As said: The following lines is only used to get the
:: "Start Menu\Program" folder, (obvious if description is readed).
:_path(1) The below line is 121 characters long,
start /wait regedit /e %temp%.\1.scr "HKEY_CURRENT_USER\Software\Microsoft\W
indows\CurrentVersion\Explorer\Shell Folders"
find.exe /i """Programs""=" < %temp%.\1.scr > %temp%.\_path.bat
echo> %temp%.\1.scr f100 Lff00 0
echo>>%temp%.\1.scr L
echo>>%temp%.\1.scr e100 ' path'
echo>>%temp%.\1.scr w
echo>>%temp%.\1.scr s100 '\'
echo>>%temp%.\1.scr q
debug<%temp%.\1.scr %temp%.\_path.bat|find ":">%temp%.\BSlshLst.bat
echo> %temp%.\2.scr f100 ffff 0
echo>>%temp%.\2.scr L
echo>>%temp%.\2.scr e100 ' %%1 '
echo>>%temp%.\2.scr m111 ffff 10a
echo>>%temp%.\2.scr w
echo>>%temp%.\2.scr q
:Loop
debug<%temp%.\2.scr > nul %temp%.\BSlshLst.bat
call %temp%.\BSlshLst.bat %0
type %temp%.\BSlshLst.bat | find ":" > %temp%.\BSlshLst.bat
if not errorlevel 1 goto Loop
for %%f in (1.scr 2.scr BSlshLst.bat) do erase %temp%.\%%f
goto ÿ eof
:_path(2)
echo> %temp%.\1.scr eff d
echo>>%temp%.\1.scr m%2 ffff %1
echo>>%temp%.\1.scr mfe ffff ff
echo>>%temp%.\1.scr w
echo>>%temp%.\1.scr q
debug<%temp%.\1.scr>nul %temp%.\_path.bat
:ÿ (An ASCII 255 char prefixed with a colon), eof.
::----Under Construction,
@echo off
for %%c in (%temp%.\ cd explorer) do %%c %temp%.
rem > $
::----ALL LINES BELOW BEGINS WITH EITHER "::echo>>" OR " echo>>"
::----IF NOT, UNWRAP BROKEN LINES,
::echo>>$% 01 % Dim WSHShell, objArghs,DesktopPath,SCName,MyShortcut
echo>>$% 02 % Set WSHShell =WScript.CreateObject("WScript.Shell")
echo>>$% 03 % Set objArghs =WScript.Arguments
::echo>>$% 04 % DesktopPath =WSHShell.SpecialFolders("Desktop")
::echo>>$% 05 % SCName ="\" + objArghs(3) + ".lnk"
::echo>>$% 06a% Set MyShortcut=WSHShell.CreateShortcut(DesktopPath & SCName)
echo>>$% 06b% Set MyShortcut=WSHShell.CreateShortc
ut("%temp%" & "\" + objArghs(3) + ".lnk")
echo>>$% 07 % MyShortcut.TargetPath = objArghs(0) + "\" + objArghs(1)
echo>>$% 08 % MyShortcut.WorkingDirectory= objArghs(0)
::echo>>$% 09 % MyShortcut.WindowStyle = 4
::echo>>$% 10a% MyShortcut.IconLocation = objArghs(0) + "\" + objArg
hs(1) + ", " +objArghs(2)
::echo>>$% 10b% MyShortcut.IconLocation = MyShortcut.TargetP
ath + ", " +objArghs(2)
::echo>>$% 10c% MyShortcut.IconLocation = "%windir%\sys
tem\PIFMGR.DLL" + ", " +objArghs(2)
echo>>$% 10d% MyShortcut.IconLocation = "%windir%\MOR
ICONS.DLL" + ", " +objArghs(2)
echo>>$% 11 % MyShortcut.Save
::----END OF ALL LINES BEGINS.
type $ > "LNK on desktop.vbs"
:: if 10a/10b
::start wscript "LNK on desktop.vbs" %windir% regedit.exe 2 "Reg Editor"
:: if 10c
::start wscript "LNK on desktop.vbs" %windir% regedit.exe 36 "Reg Editor"
:: if 10d
start wscript "LNK on desktop.vbs" %windir% regedit.exe 91 "Reg Editor"
erase $
echo.
echo. Wait a second and see the created file:
for %%c in (echo. pause cls del) do %%c "%temp%\Reg Editor".lnk
Links:
Page 2 (sort with use of @bubble.vbs or @QuickS.WSF).
Usenet.lnk, courtesy: Andreas Kaestner.
LINK.BAT
I don't know what to name this technique:
%1 %2 %4 "2 %2" %5 %6 %1\%2 %1\%2 %6 %6 %6 / 0 0 0
2 3 4 5 6 7 8
====== ------ ====== ------ ------ ------ ======
%4 "2 %2" %5 %6 %1\%2 %1\%2 %6 %6 %6 / 0 0 0
%4 "2 %2" %5 %1\%2 %1\%2 / 0 0 0
%4 "2 %2" %1\%2 %1\%2 / 0 0 0
"2 %2" %1\%2 %1\%2 / 0 0 0
If six circus performers was standing like this:
(the one at the top with a ball on his head),
0
6
5
and numb 6 by an accident toke one step left, then
the person numb 5 would get the falling ball (zero) on his head.
Benny Pedersen. April 17, 2002,
If no arguments in passing, the help file with the required syntax/
purpose would be displayed.
To see how it works with few arguments, you can substitute the
first REM-Line (::) with one of the following:
----------------- Path file destPath name icon numb
- All 6 arguments: 1 2 3 4 5 6
if %1/==/ %0 %winDir% WelCome.exe "%temp%" "" ProgMan.exe 23
- 5 arguments. Use default icon numb 0,
if %1/==/ %0 %winDir% WelCome.exe "%temp%" "" ProgMan.exe
- 4 arguments. Use default icon source & numb,
if %1/==/ %0 %winDir% WelCome.exe "%temp%" ""
- 3 arguments. LinkName to be "2 WelCome.exe",
if %1/==/ %0 %winDir% WelCome.exe "%temp%"
- 2 arguments. Create LNK file on the Desktop,
if %1/==/ %0 %winDir% WelCome.exe
- 1 argument only (as a folder specification) is not to be used.
As is, if a file is dragged & dropped, it simply creating a link to
that file on the Desktop.
-------------------------------------------------------------------
35 Lines, 1884 bytes,
@%7%8 echo off
:: %0 %winDir% WelCome.exe "%temp%" "" ProgMan.exe 23 goto:WSHShell
if %2/==/ %0 "" %1 ("DeskTop") "Press[F2]" %1 0 goto: WSHShell goto
:WSHShell (test specification: line numb 2, remove the prefixed ::)
for %%( in (%%WSHShell.SpecialFolders() do set cmdline=%%%3
for %%%% in (() do set cmdline=%%%cmdline%
if %cmdline%( ==(( set cmdline=%cmdline%WSHShell.SpecialFolders(DT)
for %%$ in (%temp%.\ chdir) do %%$ %temp%.
echo> $.vbs% 01% Set WSHShell=WScript.CreateObject("WScript.Shell")
echo>>$.vbs% 02% Set Arg=WScript.Arguments
echo>>$.vbs% 03% Set MyShortcut=WSHShell._
echo>>$.vbs% 03% CreateShortcut%cmdline%&"\"+ Arg(2) + ".lnk")
echo>>$.vbs% 04% MyShortcut.WorkingDirectory= Arg(0)
echo>>$.vbs% 05% MyShortcut.TargetPath = Arg(0) + "\" + Arg(1)
echo>>$.vbs% 06% MyShortcut.IconLocation = Arg(4) +", " + Arg(8)
echo>>$.vbs% 07% MyShortcut.Save
start /wait wscript $.vbs %1 %2 %4 "2 %2" %5 %6 %1\%2 %1\%2 %6 %6 %6 / 0 0 0
for %%c in (goto:EOF rem:"explorer.exe/e,./root,,/select," del) do %%c $.vbs
:echo
echo:
echo: Arg(1) Arg(2) Arg(3) Arg(4) Arg(5) Arg(6)
echo: [sourcePath] [fileName], ["destPath"] [linkName], [icon source] [numb]
echo:
echo: Example: LINK.BAT %winDir% WelCome.exe "%temp%" "" ProgMan.exe 23
echo:
set cmdline=folder in brackets
echo: Argument(3) always "quoted". Can be used to assign a special %cmdline%
for %%c in (AllUsersDesktop AllUsersStartMenu ) do echo: ("%%c")
for %%c in (AllUsersPrograms AllUsersStartup ) do echo: ("%%c")
for %%c in (Favorites Fonts MyDocuments NetHood) do echo: ("%%c")
for %%c in (PrintHood Programs Recent SendTo ) do echo: ("%%c")
for %%c in (StartMenu Startup Templates ) do echo: ("%%c")
echo: A single file argument is okay, so, just drag & drop.
:: for %%c in (pause cls goto:EOF) do %%c
:EOF
Notes:
To use the explore feature in line number 18, move the rem:
for %%c in (goto:EOF rem:"explorer.exe/e,./root,,/select," del)...snipped.
for %%c in (goto:EOF "explorer.exe/e,./root,,/select," rem:del)...snipped.
& BTW. An alternative/better Explorer is in fact included with your Win9X,
actually. Just follow the below link to my supplementary page for garbage.
Links:
Section Trash
Icon Snatcher
The danger WEB
Hi,
Here's a batch file that would block up the dangerous
websites that would like to ruin/spoil your Win98 computer.
It work like this:
First I'm exporting the following two registry keys:
1.) HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\
Internet Settings\ZoneMap
2.) HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\
Internet Settings\Zones
both the keys is stored in a file named "%temp%.\$s.reg". A file named
"%temp%.\$spy.reg" is then created like this:
The file "%temp%.\$spy.reg" contents the websites along with a dword =
00000004, and that information goes to the first key "KEY(1.)\Domains\
website". (There is 21 such items).
The second key: "KEY(2.)\4" is then affected by new dwords 1001...1E05
along with "CurrentLevel"=dword:00012000.
I don't know if the second key above is the same with another computer
without a danish Win98, IE 6.0 but I toke the dwords that was modified
after I was setting the classified zone to the highest security level?
If you don't like that, then delete all lines prefixed uppercase ECHO.
Benny Pedersen, http://2dos.homepage.dk/
PS. 83 lines, 4096 bytes,
@echo off% DangerWEB.BAT to BlockUp%
set cmdline= If U ready to move the file %temp%.\$s.reg to a safe place, % %
if exist %temp%.\$s.reg for %%c in (echo pause cls goto) do %%c%cmdline%then
goto Continue
:If
for %%c in (goto:EOF "explorer /e,. /root,, /select,") do %%c %temp%.\$s.reg
:Continue
set cmdline=HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\
set cmdline=%cmdline%CurrentVersion\Internet Settings\Zone
for %%c in (Map s) do start /wait regedit /e %temp%.\$%%c.reg "%cmdline%%%c"
ren %temp%.\$Map.reg $spy.*
copy /b %temp%.\$s.reg + %temp%.\$spy.reg = %temp%.\$s.reg> nul
set cmdline=HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\
set cmdline=%cmdline%CurrentVersion\Internet Settings\Zone> %temp%.\$spy.reg
echo>>%temp%.\$spy.reg REGEDIT4
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\admonitor.net]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\excite.com]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\doubleclick.net]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\doubleclick.com]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\linkexchange.com]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\valueclick.com]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\sexlist.txt]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\sextracker.txt]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\sextracker.txt\counter3]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\sexlist.com]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\sextracker.com]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\sextracker.com\counter3]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\flexactive.com]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\flycast.com]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\gator.com]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\gator.net]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\cometcursor.com]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\comet.com]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\mycometcursor.com]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\onflow.com]
echo>>%temp%.\$spy.reg "*"=dword:00000004
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\onflow.txt]
echo>>%temp%.\$spy.reg "*"=dword:00000004
ECHO>>%temp%.\$spy.reg [%cmdline%s\4]
ECHO>>%temp%.\$spy.reg "1001"=dword:00000003
ECHO>>%temp%.\$spy.reg "1200"=dword:00000003
ECHO>>%temp%.\$spy.reg "1400"=dword:00000003
ECHO>>%temp%.\$spy.reg "1402"=dword:00000003
ECHO>>%temp%.\$spy.reg "1405"=dword:00000003
ECHO>>%temp%.\$spy.reg "1407"=dword:00000003
ECHO>>%temp%.\$spy.reg "1604"=dword:00000001
ECHO>>%temp%.\$spy.reg "1606"=dword:00000003
ECHO>>%temp%.\$spy.reg "1607"=dword:00000003
ECHO>>%temp%.\$spy.reg "1608"=dword:00000003
ECHO>>%temp%.\$spy.reg "1800"=dword:00000003
ECHO>>%temp%.\$spy.reg "1802"=dword:00000001
ECHO>>%temp%.\$spy.reg "1803"=dword:00000003
ECHO>>%temp%.\$spy.reg "1804"=dword:00000003
ECHO>>%temp%.\$spy.reg "1A00"=dword:00010000
ECHO>>%temp%.\$spy.reg "1A02"=dword:00000003
ECHO>>%temp%.\$spy.reg "1A03"=dword:00000003
ECHO>>%temp%.\$spy.reg "1A05"=dword:00000003
ECHO>>%temp%.\$spy.reg "1A06"=dword:00000003
ECHO>>%temp%.\$spy.reg "1C00"=dword:00000000
ECHO>>%temp%.\$spy.reg "1E05"=dword:00010000
ECHO>>%temp%.\$spy.reg "CurrentLevel"=dword:00012000
for %%c in ("start.exe /wait " del) do %%c %temp%.\$spy.reg
%0
:EOF
Modification. Add the following 10 Websites:
echo>>%temp%.\$spy.reg [%cmdline%Map\Domains\kazaa.com]
echo>>%temp%.\$spy.reg "*"=dword:00000004
And so on...
...Snipped, imesh.com audiogalaxy.com grokster.com limewire.com bearshare.
com downloadaccelerator.com real.com bonzi.com alexa.com
MultiClip.bat
My Multi Clipboard below is inspired of a script by William Allen, just try:
@echo off
if exist %temp%.\_CLIP.HTM goto MultiClip
find.exe>%temp%.\_CLIP.HTM " % --%;" < %0
REM: [put modification here]: (See PS.: )
goto MultiClip
<html><body style="background-color:#000066 ;color:#faebd7;margin-left:10px;
scrollbar-arrow-color: #ffff00 ; scrollbar-track-color:#000000;
font-family:'andale mono',verdana ;scrollbar-face-color:#000066;
font-size: 11pt;text-align:center ;"alink=#000000 vlink=#faebd7>
<textarea rows=05 cols=78 style="scrollbar-track-color:yellow">
<!--
</textarea><br><!-- ~2 -->
:MultiClip
echo> %temp%.\~.VBS set sh=WScript.CreateObject("WScript.Shell")
echo>>%temp%.\~.VBS sh.Run("%windir%\notepad.exe %temp%.\_CLIP.HTM")
echo>>%temp%.\~.VBS WScript.Sleep(200)
echo>>%temp%.\~.VBS sh.SendKeys("^{end}^{v}%%{F4}{enter}")
find.exe "a% % r" <%0>> %temp%.\_CLIP.HTM
start.exe /min /wait cscript.exe /nologo %temp%.\~.VBS
find.exe " % %~2" <%0>> %temp%.\_CLIP.HTM
start.exe %temp%.\_CLIP.HTM
erase %temp%.\~.VBS
exIT [Omit this line] The above MultiClip.BAT is exact 22 lines, 1049 bytes.
Benny Pedersen,
PS.:
17 lines, 1218 bytes below is for the modification, see line numb 4 above.
ECHO @PROMPT $LA HREF="http://2dos.homepage.dk/"$G$LIMG SRC=>%temp%.\£.BAT
ECHO.-------------------------->c:\windows\temp\N.GIF
ECHO @PROMPT %%PROMPT%%"file:///c:/windows/temp/N.GIF" BORD>>%temp%.\£.BAT
ECHO @PROMPT %%PROMPT%%ER="0" ALT="Zzzzzzzzz"$G$L/A$G$LBR$G>>%temp%.\£.BAT
%COMSPEC% /E:1024/C%temp%.\£.BAT >> %temp%.\_CLIP.HTM
ECHO e100 'GIF89a '0' '0 B3 0 0 0 0 0 FF 0 0 FF CC'3'FF FF 0 FF> %temp%.\£
ECHO e11A FF 99 FF FF CC FF FF FF F8 BF'$[ 2dos.homepage.dk ]$'>>%temp%.\£
ECHO e13D '!'F9 4 1 0 0 7 0','0 0 0 0' '0' '0'@'4 8C F0 C8'I'AB>>%temp%.\£
ECHO e155 BD'w' E8 1 F6 EE 9C A7 81 1A 25 8A'@'AA AE E4'i'9E 1E>>%temp%.\£
ECHO e168 B'o'D8'1'B6'sZZs'EF D3 92 1E'k8'AB FD'`'B5 CC'q'90 9C>>%temp%.\£
ECHO e17F','7F BC D3'J'AA'B'6'}'C3'j'EF 9A CB'j'AD'6a`L'E E0 3C>>%temp%.\£
ECHO e196 CA A7 AB'Y)'B2 9B EE F7 8B F3 A5 EB'v'C9 91':'C4'L'E7>>%temp%.\£
ECHO e1AA F4 3E'm(1'84 1F'k\{['88']2'81'aB^'8E'X^wV'93 94 8A 8F>>%temp%.\£
ECHO e1C5 'Td'0 9C'gx'8B'(ef'99's'89'hF'A7 '}oOr'AE'l'11 0 0';'>>%temp%.\£
FOR %%D IN (F125L018''00 rCX df w100 quit ) DO ECHO %%D>>%temp%.\£
DEBUG c:\windows\temp\N.GIF>NUL<%temp%.\£
FOR %%F IN (£ £.BAT) DO ERASE %temp%.\%%F
:: BTW. If you do the suggested modification, then you'll endup with a file,
:: which is 1049 +1218 -45 = 2222 bytes (-45 is the substituted line numb 4)
:: but since the above modification ONLY is written once, i.e. when the file
:: c:\windows\temp\_CLIP.HTM (=the Multi Clipboard) don't exist, then you'll
:: have to delete the Multi Clipboard, and then you'll see the modification.
:: Hint.: When you are writting batch files and modify a bit, then you could
:: get backups in chronological order. Copy, then hit the MultiClip.bat file
:: periodically. When I worked with this MultiClip.BAT file, I often changed
:: a bit but I got some nice/useful backups on my temporary Multi Clipboard.
:: Note: To copy a single board from the Multi Clipboard, just open the HTML
:: file, right click & hit the SELECT ALL option from within the popup menu.
:: Modification numb 2:
:: Using a much better text editor than Notepad. For example the PFE Editor:
echo>>%temp%.\~.VBS sh.Run("%windir%\command\pfe32.exe %temp%.\_CLIP.HTM")
rem: Options, Preferences, Startup: [ ]_Only run one instance at any time.
:: Modification numb 3:
:: Prefix line numb 26, (it's the line which contents the word yellow), with
:: the following seven characters: --><br>
:: then put one of the following 3 lines as a new line numb 34:
echo:exit| %comspec%/kprompt { $P $B $D $B $T: }$L!-- >> %temp%.\_CLIP.HTM
echo: :exit:| %comspec%/kprompt [$P $B $D $B $T]:$L!-->> %temp%.\_CLIP.HTM
echo. exit|%comspec%/kprompt • $D: $T: •$L!-->>%temp%.\_CLIP.HTM
:: it looks something like this:
echo>>%temp%.\~......[Snipped the line numb 33.]
echo. exit|%comspec%/kprompt • $D: $T: •$L!-->>%temp%.\_CLIP.HTM
find.exe "a% % ......[Snipped the old line numb 34. It's now line numb 35]
:: The above modification, writing a heading to each clipboard: $P = "PATH",
:: so, if MultiClip.bat is placed and used in a folder named Peter, the info
:: "Peter" would be a heading for that Clipboard. $D and $T = Date and time.
:: BTW. Here's a Red-head:
<head><title>Multi Clip</title><style>.wow{color:red ;}</style></head>
:: An example for the above modification numb 3:
:: Substitute new line 34, the • with $Lspan class=wow$G•$L/span$G
Links:
PIC.BAT (a previous work that I did, very useful when I wrote the above.)
Get shorter names solution.
("gwen" wrote:
In testing moving-renaming folders, we observed that 29 characters is the
limit for a folder name, when using a vbs-bat file. The basic command looks
like this: move "%WINDIR%\DESKTOP\%FN%" "%WINDIR%\TEST\abcd%FN%abcd"
The way it works is that cscript runs a vbs file to bring up an Enter Folder
Name box. The file is run in Windows 95\98
We're wondering why 29 and if there's a way to make the file accept longer
folder names?
puzzled!
thanx
gwen
)
Maybe it's something about the DIM which is the problem but I
don't know. I have just said an order for a WSH book from the
local bookshop but it wasn't arrived.
The below tricks is only working when the file exist.
Benny Pedersen,
BTW. Any file that you drag & drop onto the icon of
this batch would simply be displayed as "short DOS name"
so, if you want, then you may copy & paste from the CON.
Get SHORT NAME.bat
@echo off
if not %1.==. goto (shortName when %1 is not blank).
:: create a test file:
XCOPY<%0 >nul %0 "%windir%\Long Name Folder\Long Name.123"
%comspec%/c%0 "%windir%\Long Name Folder\Long Name.123
echo. % Clean up, (ask about deleting.): %
deltree "%windir%\Long Name Folder"
for %%c in (cls goto:eof) do %%c
:(shortName
path %1
echo Short name is %path%
:eof
Extra related info: To get a long file name, just drag & drop
a file somewhere onto the dialog menu of: Start, Run.
click somewhere on the dialog menu outside your text.
Links about how to paste:
(automatic), Page 7, Multi Clip
or (manual), Free (don't click the pic of the sun).
Echo on/off
PROMPT along with "ECHO ON", 'Blank line and "@ECHO OFF".
If using a single quote in WSH ('), then it can be in 2 lines, not 4
1 PROMPT Something
2 ECHO ON
3
4 @ECHO OFF
1 PROMPT if instr(lcase(wscript.fullname), "wscript.exe")$g0 then '
2 FOR %%o in (n ff) do echo o%%o
Benny Pedersen,
@echo off
goto %1 :Begin -------------------------------------------------------
' Comments such as author, filesize, usage, etc...
Standard Template for DOS-Batch/VBS/WSH programming
May 2002 by Benny Pedersen, http://2dos.homepage.dk
: Begin -------------------------------------------------------
::for %%c in (%ComSpec% goto:eof) do %%c /cstart.exe/min %0 :CreateVBS
: CreateVBS
%ComSpec% /c%0 :WriteScr echo :: > %temp%.\~.VBS
: RunScript
start.exe/wait wscript.exe //t:9 %temp%.\~.VBS
start.exe /max /wait cscript.exe %temp%.\~.VBS //nologo arg >> CON
: Done
for %%c in (:::pause :::cls :::set erase:%temp%.\~.VBS) do %%c
goto :eof
Library
%2 if not fso.folderexists(named) then
%2 etc...
: WriteScr ___________________________________________________________
%2 set fso = CreateObject("Scripting.FileSystemObject")
%2 if fso.FileExists("c:\config.sys") then
%2 wscript.echo "True"
%2 else
%2 wscript.echo "False"
%2 end if
%2.
%2 if wscript.arguments.count=1 then wscript.sleep(799)
PROMPT if instr(lcase(wscript.fullname), "wscript.exe")$g0 then'
FOR %%o in (n ff) do echo o%%o
%2 wscript.echo "You are using wscript, not cscript"
%2 wscript.quit
%2 end if
:EOF
::for %%c in (REM:" %0, not CON at :RunScript" ctty goto::) do %%c NUL
Most About VBS and Date
The above Standard Template is modified a bit in the following example
which topic is most about VBS; "Counting days" and "Yesterday's date".
@echo off
goto %1 Begin --------------------------------------------------------
Used Standard Template to DOS-Batch/VBS/WSH programming.
May 17, 2002 by Benny Pedersen, http://2dos.homepage.dk/
:Begin --------------------------------------------------------
::for %%c in (%ComSpec% goto:End) do %%c /cstart.exe/min %0 :CreateVBS
:CreateVBS Arg2
%ComSpec% /c%0 Write echo > %temp%.\~.VBS
:RunScript
start.exe /wait wscript.exe %temp%.\~.VBS //t:10
::start/max /wait cscript.exe %temp%.\~.VBS //nologo Arg0 >> CON
:Done
::for %%c in (:::set :::pause :::cls erase:%temp%.\~.VBS) do %%c
Notepad.exe %temp%.\~.VBS
:End
for %%c in (:::exit rem:OR: ctty goto::) do %%c nul
Local library
%2: dim obj
%2: set obj = wscript.arguments
%2:
%2: for each arg in obj
%2: wscript.echo arg
%2: next
%2:' etc...
______________________________________________________________________
:Write
set cmdline= % %
%2:' CountDays.vbs
%2: % %
%2: function countDays(theDate)
%2: CountDays = datediff("d", date, cdate(theDate))
%2: end function
%2:
%2: dim Days
%2: Days = countDays("24-12-" & year(date))
PROMPT $ if Days $G 0 then'%cmdline%%cmdline%%cmdline% ignore:
FOR %%o in (n ff) do %2:o%%o
%2: msgbox "Xmas: " & Days & " day(s)"
PROMPT $ elseif Days $L 0 then'%cmdline%%cmdline%%cmdline% ignore:
FOR %%o in (n ff) do %2:o%%o
%2: msgbox "Over"
%2: else
%2: msgbox "%cmdline%T" &vbCrLf &"%cmdline% o" &vbCrLf &vbCrLf &_
%2: "%cmdline%D" &vbCrLf &"%cmdline% a" &vbCrLf &"%cmdline% y"
%2: end if
goto --(end of write script)--
%2:' Date of yesterday
%2: % %
goto 3'th_solution (3/2/1).
: 3'th_solution (`dateAdd instead of `case or `if)
%2: msgBox "Yesterday was" &vbCrLf & dateAdd("d", -1, date)
goto --(end of write script)--
: 2'th_solution (`case instead of `dateAdd or `if)
%2: dim D, M, Y
%2: D = day(now)
%2: M = month(now)
%2: Y = year(now)
%2:
%2: if D = 1 then
%2: select case M
%2: case 1 Y = Y -1
%2: M = 12
%2: D = 31
%2: case 3 M = 2
%2: D = 28 -((Y mod 4)=(0))
%2: case 5,7,10,12 M = M -1
%2: D = 30
%2: case else M = M -1
%2: D = 31
%2: end select
%2: else
%2: D = D -1
%2: end if
%2:
%2: wscript.echo "Yesterday, Day Month Year: " &D &" " &M &" " &Y
goto --(end of write script)--
: 1'th_solution (`if instead of `dateAdd or `case)
%2: dim D, M, Y
%2: D = day(now)
%2: M = month(now)
%2: Y = year(now)
%2:
%2: if D = 1 then
%2: if M = 1 then
%2: Y = Y -1
%2: M = 12
%2: D = 31
%2: else
%2: M = M -1
%2: if M = 2 then
%2: D = 28 -((Y mod 4)=(0))
%2: else
%2: dim Array(3)
%2: Array(0) = 4
%2: Array(1) = 6
%2: Array(2) = 9
%2: Array(3) = 11
%2: for each LittleMonth in Array
%2: if M = LittleMonth then
%2: D = 30
%2: else
%2: if not D = 30 then D = 31
%2: end if
%2: next
%2: end if
%2: end if
%2: else
%2: D = D -1
%2: end if
%2:
%2: wscript.echo "Yesterday, Day Month Year: " &D &" " &M &" " &Y
: --(end of write script)--
Here is another template along with my latest discoveries and constructions.
Maybe worth a study.
Benny Pedersen,
PS. A related link for a Registry solution: UseNet.
Tips: Adjust/scrool your horizontal trackbar,
@ echo off
if %1.SubRoutine==MakeScr.SubRoutine goto %1. Handler Arg2 Arg3 Arg4
%ComSpec% /c%0 MakeScr> %temp%.\~.vbs echo prompt:$ script
start /wait wscript.exe %temp%.\~.vbs //t:16 c:\ config autoexec.bat
start /wait cscript.exe %temp%.\~.vbs //nologo Arg0 Arg1
Notepad %temp%.\~.vbs
rem del %temp%.\~.vbs
@ exit
:MakeScr ___________________________________________________________________
%3: if w%4.arguments.count $G 2 then'
% '%FOR %%n in (n ff) do, %2 o%%n
%2: dim arg, fso
%2: set arg = w%4.arguments
%2:
%2: for each obj in arg
%2: w%4.%2 "___________" &vbCrLf&vbCrLf &obj &vbCrLf &"___________"
%2: next
%2:
%2: set fso = CreateObject("%4ing.FileSystemObject")
%2:
%2: if fso.fileExists(Arg(0) & Arg(1) & ".sys" ) then
%2: w%4.%2 "Config exist"
%2: elseif fso.fileExists(Arg(0) & Arg(2)) then w%4.%2 "Batch exist!"
%2: else
%2: w%4.%2 "None exist"
%2: end if
%2: end if
%3: if instr(lcase(w%4.fullname), "c%4.exe") $G 0 then
%2 on
% %
@%2 off
%2: w%4.%2 "You are using c%4, not w%4."
%2: w%4.sleep(2000)' 2 seconds
%2: end if
|