Command Path

  • Thread starter Thread starter Sid Knee
  • Start date Start date
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.
 
\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.
 
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%
 
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.
 
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?
 
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.
 
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"
 
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!
 
Back
Top