Computing.Net > Forums > Disk Operating System > How to Make a .bat file 2 run programs on usb

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

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

Reply to Message Icon

Name: ryandgiweed
Date: August 22, 2009 at 01:44:24 Pacific
OS: Windows XP
Subcategory: General
Tags: .bat, usb, Programs, run, automatically
Comment:

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.?..



Sponsored Link
Ads by Google

Response Number 1
Name: ricardo647
Date: August 22, 2009 at 04:44:03 Pacific
Reply:

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.


0
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


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

I want to make a bat file www.computing.net/answers/dos/i-want-to-make-a-bat-file/2601.html

call multiple progs in a .bat file www.computing.net/answers/dos/call-multiple-progs-in-a-bat-file/12098.html

Making a .bat file to get input www.computing.net/answers/dos/making-a-bat-file-to-get-input/12821.html