Ways to add a program shortcut to a WinPE

Source: Internet
Author: User
Tags goto

After creating a shortcut in any win environment, through the script to extract its path, and modify for the current PE suitable path to create a new shortcut, so invoke the script after the corresponding shortcut (PE desktop, Start menu, etc.) is able to use, and "U Disk free program Shortcuts" in the shortcut may not be used.

Function: Put the program to be used in the "Free program" folder under the root directory of U disk or other disk, go to the appropriate program folder, create a shortcut for the file to be executed (no problem with what system is created, XP is OK, normal Windows is on line), and copy the shortcut to the Free program shortcuts under the appropriate folder, when the PE starts and executes this script, it will create a shortcut in the appropriate place.

Example: FinalData, the shortcut to be established is "Start menu program Data Recovery FinalData", as follows:

(This operation does not have to be done under PE, all windows are OK)

1, copy "FinalData" folder to the U disk root directory under the "Free Program" folder,

2, enter the U disk free program FinalData, for FINALDATA.exe and Finaldata.reg to establish a shortcut

3, FINALDATA.exe shortcut copy to the U disk free program shortcut Start menu Program Data Recovery, finaldata.reg shortcut menu Copy to the U disk free program shortcut execution, when PE starts and executes this script, The Finaldata.reg registration FinalData is run and a shortcut is established in the appropriate place.

For programs that are not EXE-formatted, the icon for the shortcut will be random.

The execution folder inside put your Reg, CMD, and so on the registration file, is your program execution to execute before, put the shortcut inside is OK!!! " Shortcuts "There are shortcuts in all of them!"

The program is as follows, and the file name is LINKS. CMD, scripts are mixed for pecmd and MS-DOS format, can be invoked directly or with the Pecmd Load command (recommended)

This script is in XP SP3 CMD. EXE (5.1.2600) pecmd. EXE (3.6.0930.309) pass the test, the other environment please self-test

:: ' script started

GOTO Cmdmode

_sub Cmdmode

: Cmdmode

Setlocal enabledelayedexpansion

ECHO off

Cls&>%temp%links. INI ECHO.

IF%1.==. GOTO Notpecmd

SET prodirname=%1

SET linksdir=%prodir% Shortcuts

For%%k in (Start menu desktop perform boot fast start Send to favorites my document) do (

SET fromdir=%%k

IF! fromdir!. = = Start Menu. (SET todir=%startmenu%) ELSE (

IF! fromdir!. = = Desktop. (SET todir=%desktop%) ELSE (

IF! fromdir!. = = Execute. (SET _setup=1) ELSE (

IF! fromdir!. = = Quick Start. (SET todir=%quicklaunch%) ELSE (

IF! fromdir!. = = Send To. (SET todir=%sendto%) ELSE (

IF! fromdir!. = = Boot boot. (SET todir=%startup%) ELSE (

IF! fromdir!. = = Favorite folder. (SET todir=%favorites%) ELSE (

IF! fromdir!. = = My document. SET todir=%personal%

) ) ) ) ) ) )

IF EXIST "%linksdir%! fromdir! " for/f "tokens=*"%%i In (' dir/a/b/s "%linksdir%! fromdir!*. LNK "') Do (

SET ii=%%i

SET ii=!ii:~13,-4!

for/f "tokens=1,* delims="%%a in (' ECHO!ii! ') Do SET lnkpath=%%b

for/f "tokens=*"%%j in (' TYPE '%%i "^| Find "" ^| Find "." ') Do (

for/f "tokens=1,* delims=%1"%%a in (' ECHO%%j ') do (

SET _ext=%%b

SET _ext=!_ext:~-3!

IF not!_setup!. ==1. (

if/i not!_ext!. ==exe. (

set/a _icoid=%random%%%222

SET _icon=,,shell32. dll#!_icoid!

>>%temp%links. INI ECHO LINK! todir!! Lnkpath!,! prodir!%%b!_icon!

) ELSE (

>>%temp%links. INI ECHO LINK! todir!! Lnkpath!,! Prodir!%%b

)

) ELSE (

if/i!_ext!. ==reg. (

>>%temp%links. INI ECHO EXEC REGEDIT. EXE/S! Prodir!%%b

) ELSE (

>>%temp%links. INI ECHO EXEC @! Prodir!%%b

)

)

)

)

)

)

GOTO End

: Notpecmd

ECHO.

ECHO.

ECHO.

ECHO function: Put the program to be used in the "Free Program" folder in the root directory of U disk or other disk, and enter the corresponding

The ECHO program's folder, to create a shortcut to the file to be executed (under what system is not a problem to build, XP Also

ECHO line, normal windows, and copy the shortcut to the appropriate file under free program shortcuts

Inside the ECHO folder, when PE starts and executes the script, it creates a shortcut in the appropriate place.

ECHO.

ECHO.

ECHO make by GoSun 2009.11

Pecmd LOAD LINKS. Cmd

GOTO End

_end

Forx @ free program, Prodir,0,exec =! LINKS. CMD Free Procedure

Team LOAD%temp%links. ini| FILE%temp%links. Ini

MESS loaded successfully!@ loaded successfully #OK *500 ' here is the message after the completion, you can cancel

: End

:: ' End of script

This script runs to generate temporary files (which will be deleted when finished) and if you do not want to generate temporary files, please >>%temp%links. The INI Echo is replaced with Pecmd, but the operating efficiency is reduced.

Attached file directory structure:

V: Free Procedure

V: Free Program 1

V: Free Program 2

V: Free program shortcuts

V: Free program Shortcut execution

V: Free Program Shortcuts desktop

V: Free program shortcuts boot up

V: Free program Shortcuts Quick Start

V: Free program shortcuts are sent to

V: Free Program Shortcuts favorites

V: Free program Shortcuts My Documents

V: Free program shortcut Start Menu

V: Free program shortcut Start menu program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.