Advertisement
aveyo

LnkAllToStart

Oct 18th, 2015
1,257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.33 KB | None | 0 0
  1. @if (@Author)==(@AveYo) @end /* LnkAllToStart v1.0
  2. @echo off &setlocal &set usage=Create lnks in Start Menu to all .exe files in dropped folder target or the current dir  
  3. ::
  4. :: change start menu folder name (no spaces) below:
  5. set startmenufolder=Utilities
  6. ::
  7. SET QUIT=echo You can close me now, or wait a few seconds and I will close myself ^&PING -n 10 0 ^>NUL 2^>^&1 ^&COLOR 70 ^&EXIT/B &COLOR 70 &TITLE LnkAllToStart by AveYo
  8. :: gives time to cancel before any changes (all scripts should provide this...)
  9. FOR /L %%I IN (10,-1,1) DO CLS &echo %usage% &echo  Starting in %%Is. Press [Ctrl+C] or X corner to cancel... &PING -n 2 0 >NUL 2>&1
  10. if exist "%~1" (set "exefolder=%~1") else set "exefolder=%~dp0"  
  11. if not exist "%exefolder%\*.exe" (echo No .exe found in %exefolder% &%QUIT%) else pushd "%exefolder%"  
  12. for %%E in (*.exe) do cscript //nologo /E:JScript "%~f0" "%%~dpnE" &echo  ..creating lnk to %%~nE in %startmenufolder%
  13. md "%APPDATA%\Microsoft\Windows\Start Menu\Programs\%startmenufolder%\" >NUL 2>&1
  14. for %%L in (*.lnk) do move /y "%%L" "%APPDATA%\Microsoft\Windows\Start Menu\Programs\%startmenufolder%\" >NUL 2>&1  
  15. %QUIT%
  16. */
  17. var lnk=WScript.CreateObject("WScript.Shell").CreateShortcut(WScript.Arguments(0)+".lnk");
  18. lnk.TargetPath=WScript.Arguments(0)+".exe";
  19. lnk.IconLocation=WScript.Arguments(0)+".exe,0";
  20. lnk.Save();
  21. //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement