Command Path

S

Sid Knee

Is there a way to write a path statement that will refer to a folder on
the current drive (regardless of what drive letter it may have)?

I want to run an application (which needs a command path set from a
startup .bat file) from a USB Flash-Drive and don't want to have to give
the device a specific drive letter when I attach it.
 
G

Gary Smith

\FolderName\SubfolderName refers to the current drive, whatever it may
happen to be. Is that what you had in mind? I have a batch file on my
thumb drive which contains this line:

start \Firefox\firefox.exe -profile \Firefox\Profiles\me

Double-clicking on the file starts Firefox as expected.
 
P

Pegasus \(MVP\)

Sid Knee said:
Is there a way to write a path statement that will refer to a folder on
the current drive (regardless of what drive letter it may have)?

I want to run an application (which needs a command path set from a
startup .bat file) from a USB Flash-Drive and don't want to have to give
the device a specific drive letter when I attach it.

Sure - try this:

path %path%;%cd%
 
D

Dave Patrick

Also look at;
%cd%
(current directory)

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| Is there a way to write a path statement that will refer to a folder on
| the current drive (regardless of what drive letter it may have)?
|
| I want to run an application (which needs a command path set from a
| startup .bat file) from a USB Flash-Drive and don't want to have to give
| the device a specific drive letter when I attach it.
 
S

Sid Knee

Pegasus said:
Sure - try this:

path %path%;%cd%

Ah .... I see some light. Does the " cd " refer to the root or the
current directory. If it's the latter, does that mean I would have the
bat file first change to the directory of interest, then set up the path
as you show then carry on from there?
 
S

Sid Knee

No, what I'm looking for is a way to set a command path as in the PATH
statement .... not simply referring to the current drive on the command
line. Thanks for the response though.
 
P

Pegasus \(MVP\)

Sid Knee said:
Ah .... I see some light. Does the " cd " refer to the root or the
current directory. If it's the latter, does that mean I would have the
bat file first change to the directory of interest, then set up the path
as you show then carry on from there?

Yes. An expanded version might look like so:
@echo off
cd "\Some Folder"
path %path%;%cd%
cd "Some other folder"
 
S

Sid Knee

Pegasus said:
Yes. An expanded version might look like so:
@echo off
cd "\Some Folder"
path %path%;%cd%
cd "Some other folder"

Super ... exactly what I need. Thanks a bunch!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top