How to Make a .bat file 2 run programs on usb

August 22, 2009 at 01:44:24
Specs: Windows XP
Hey .. .i've been wondering is there anyway to make a .bat file to run programs on a usb?.. so that it will either ask you to input a name to run the software.. or it will give u a list to chose from.?..

See More: How to Make a .bat file 2 run programs on usb

Report •

#1
August 22, 2009 at 04:44:03
echo off
setlocal enabledelayedexpansion
set pathN=c
pushd %pathn%:\
::above, unit letter
set /a ct=0
for %%a in (%pathn%:\*.exe,%pathn%:\*.com,

%pathn%:\*.bat,%pathn%:\*.cmd) do (
echo %%~nxa
)
echo.
set /p ThisApp=Launch application (name):
"%ThisApp%"
popd

---------------------

I need help too.

The above code works but I fail in attribute a NUMBER for each output of FOR command in order to launch application by typing its number, not its name.
I do like this:

set /a ct=0
for %%a in (*.exe, *.com) do (
set /a ct=!ct!+1
echo !ct! - %%a
set comm!ct!="%%a"
)
set /p number=Run this application (number):
set ThisApp=comm%number%
%ThisApp%


I cant get ThisApp variable expressing its real content. It always reply with its literal value (comm1, comm2..).

Can anybody help me.


Report •

#2
April 25, 2010 at 09:49:52
I know how to make an autorun.inf file that will run anything
in the USB drive when you click on the drive. First, open up
notepad or whatever programming device you use. Then,
type the following code:

[autorun]
shellexecute=(application name in USB drive)
Action=Autorun

Now, save the file as "autorun.inf" and you are done!


Report •

#3
April 26, 2010 at 17:22:43
below is an example....menu, colors and install programs

@echo off
echo.
echo.
:menue
color 1f
echo
echo.
echo.
echo To Start XP Application Loader press A
echo.
echo To Start 2k Application Loader press B
echo.
echo To run but not install tools press C
echo.
echo To just exit this program press X
echo.
echo.
SET Choice=
SET /P Choice= TYPE THE LETTER AND PRESS ENTER: -^>
IF NOT '%Choice%'=='' SET Choice=%Choice%
:: /I makes the IF comparison case-insensitive
IF /I '%Choice%'=='a' GOTO :go2
IF /I '%Choice%'=='b' GOTO :go
IF /I '%Choice%'=='c' GOTO :tools
IF /I '%Choice%'=='x' GOTO :exit
echo "%Choice%" IS NOT VALID. PLEASE TRY AGAIN
echo.
:tools
cls
color 2f

echo TOOLS
echo ***************************************************************************
echo.
echo Start Everest press A.
echo.
echo Start SIW press B.
echo.
echo Start winfile press C.
echo.
echo Go back to main menu D.
echo.
echo To test sound card E.
echo.
echo Go to Driveragent F.
echo.
echo Majic Jelly Bean G.
echo.
echo Jelly Bean Change key H.
echo.
echo Install sp3 I.
echo.
echo MS Key changer J.
echo.
echo To exit program X.
SET Choice=
SET /P Choice= TYPE THE LETTER AND PRESS ENTER: -^>

IF NOT '%Choice%'=='' SET Choice=%Choice%
:: /I makes the IF comparison case-insensitive
IF /I '%Choice%'=='a' GOTO :everest
IF /I '%Choice%'=='b' GOTO :siw
IF /I '%Choice%'=='c' GOTO :manage
IF /I '%Choice%'=='d' GOTO :menu
IF /I '%Choice%'=='e' GOTO :sound
IF /I '%Choice%'=='f' GOTO :agent
IF /I '%Choice%'=='g' GOTO :bean
IF /I '%Choice%'=='h' GOTO :key
IF /I '%Choice%'=='i' GOTO :sp3
IF /I '%Choice%'=='j' GOTO :mskeys
IF /I '%Choice%'=='x' GOTO :exit
:everest
everest.exe
cls
goto :tools

:siw
siw.exe
cls
goto :tools

:manage
winfile.exe
cls
goto :tools

:menu
cls
goto :menue

:sound

plany work.wav
start d:\media\07-wind.mp3
cls
goto :tools

:agent
start notepad pwd.txt
start firefox.exe http://driveragent.com/
cls
goto :tools

:bean
start key\keyfinder.exe
cls
goto :tools

:key
echo starting Magic Jellybean
start keychange\keyfinder.exe
cls
goto :tools


:sp3
echo Installing sp3
start sp3\sp3.exe
cls
goto :tools

:mskeys
start mskey.exe
cls
goto :tools

:go
echo Windows 2000 media player is now loading
start /wait loadset\mpsetup.exe /qn /norestart
echo.
goto :go3

:go2
:: echo Windows xp media player is now loading.
:: start /wait loadset\wmp11-windowsxp-x86-enu.exe /qn /norestart
goto :go3

:go3
echo 7 ZIP IS NOW LOADING
echo.
start /wait loadset\7z457.exe /S
echo.
echo FOXIT READER IS NOW LOADING
echo.
start /wait loadset\FoxitReader23.msi /qn
echo.
echo FIREFOX IS NOW LOADING
echo.
start /wait loadset\Firefox3.exe /S
echo.
echo E-SWORD IS NOW LOADING
echo.
start /wait loadset\E-Sword_setup.exe /S /v/qn
echo.
echo.
echo OPEN OFFICE IS NOW LOADING
echo.
echo Please be patient, this takes a little while...
echo.
start /wait loadset\OpenOffice\openofficeorg24.msi /qn /norestart
echo.
echo AVG VIRUS PROTECTION IS NOW LOADING
echo.
start /wait loadset\avg.exe /HIDE
echo.
echo.
echo ****************************************************


:loop
cls
echo.
echo.
echo Does the computer have a Burner?
SET Choice=
SET /P Choice= TYPE THE LETTER AND PRESS ENTER: -^>
IF NOT '%Choice%'=='' SET Choice=%Choice%
:: /I makes the IF comparison case-insensitive
IF /I '%Choice%'=='y' GOTO :burner
IF /I '%Choice%'=='n' GOTO :dvd
echo "%Choice%" IS NOT VALID. PLEASE TRY AGAIN
echo.
goto :loop

:burner
echo Loading DeepBurner...
start /wait loadset\deepBurner1.exe /S
:dvd
echo.
echo.
echo Does the computer have a DVD player?
echo.
SET Choice=
SET /P Choice= TYPE THE LETTER AND PRESS ENTER: -^>
IF NOT '%Choice%'=='' SET Choice=%Choice%
:: /I makes the IF comparison case-insensitive
IF /I '%Choice%'=='y' GOTO :player
IF /I '%Choice%'=='n' GOTO :continue
echo "%Choice%" IS NOT VALID. PLEASE TRY AGAIN
echo.
GOTO :dvd

:player
echo Loading DVDplayer...
start /wait loadset\DVDplayer.exe /S


:continue
echo.
echo NOW LOADING E-SWORD ADDONS
echo.
@echo off
start /wait C:\progra~1\7-zip\7z.exe e loadset\e-Sword.7z -oC:\progra~1\e-sword
echo.
echo.
echo ZGAMES IS NOW LOADING - takes a while - you're almost there!
echo.
echo computer will restart when finished
echo.
echo ***When computer restarts-Install updates for AVG ***

start /wait C:\progra~1\7-zip\7z.exe x loadset\Zgames.7z -oC:\ -r -y


shutdown /l /r /y
:exit
cls


Report •
Related Solutions


Ask Question