You are here

For applications that need fixed drive letter

52 posts / 0 new
Last post
SmithTech
SmithTech's picture
Offline
Last seen: 6 months 4 days ago
Developer
Joined: 2006-11-24 18:06
For applications that need fixed drive letter

I found a work around for applications that need a drive letter.
Copy subst.exe from windows\system32 to your flash drive.
create a batch file with the following command.
subst.exe P: \
drive letter P: will be assigned to the flash drive you ran subst.exe from.
Now your flash drive will always have the same drive letter.
And yes this means it will actually have 2 drive letters, but P: will always be constant, it won't change.

when your done
run subst.exe /d P: to delete the drive letter, you can put this in a batch file as well.

m2
Offline
Last seen: 11 years 7 months ago
Joined: 2006-12-12 12:00
It won't change...as long as

It won't change...as long as your host machine doesn't have P: drive ;->
But for sure it's better than nothing.
BTW, you don't have to take subst with you - it in windows for quite long.

"Those people who think they know everything are a great annoyance to those of us who do." Asimov

SmithTech
SmithTech's picture
Offline
Last seen: 6 months 4 days ago
Developer
Joined: 2006-11-24 18:06
Actually you do if you want

Actually you do if you want the relative path to work in the command.
Since you won't know what drive letter is being assigned if your running it from a launch script or launch app the path needs to be relative so you get the correct drive letter.

For those who have fought for it, freedom has a flavor the protected will never know.

"Because they stand on a wall and say, 'Nothing is going to hurt you tonight. Not on my watch.'" (A Few Good Men)
Coincidence is God's way of remaining anonymous.(Albert Einstein)

m2
Offline
Last seen: 11 years 7 months ago
Joined: 2006-12-12 12:00
Maybe it's my poor English,

Maybe it's my poor English, maybe stupidity, but I don't understand your post Sad
Actually you do
I do have to carry subst with me?
if your running it from a launch script or launch app
"it" means subst?
Even if so, I don't know what are you trying to tell me Sad

"Those people who think they know everything are a great annoyance to those of us who do." Asimov

SmithTech
SmithTech's picture
Offline
Last seen: 6 months 4 days ago
Developer
Joined: 2006-11-24 18:06
Not a problem. Yes you need

Not a problem.
Yes you need to copy subst.exe to your flash drive even though it is already included in windows.
The reason is that if you are using a script or app to run subst.exe automatically when you plug in your usb drive you will not know what drive letter the usb drive is assigned.
If you don't know the drive letter the usb drive is assigned, you have to use a relative path.
In order for a relative path to work, subst.exe has to be located and run from the flash drive.
Hope that is more understandable.:)

For those who have fought for it, freedom has a flavor the protected will never know.

"Because they stand on a wall and say, 'Nothing is going to hurt you tonight. Not on my watch.'" (A Few Good Men)
Coincidence is God's way of remaining anonymous.(Albert Einstein)

m2
Offline
Last seen: 11 years 7 months ago
Joined: 2006-12-12 12:00
Thank you, it is :)

If you don't know the drive letter the usb drive is assigned, you have to use a relative path.
Where?
My app doesn't understand relative paths, so I use paths starting P: for it.
My launcher calls "subst P: \"
So I need it somewhere else?

"Those people who think they know everything are a great annoyance to those of us who do." Asimov

SmithTech
SmithTech's picture
Offline
Last seen: 6 months 4 days ago
Developer
Joined: 2006-11-24 18:06
The syntax for subst.exe is

The syntax for subst.exe is ...
SUBST [drive1: [drive2:]path]
when you plug in your usb drive lets say it is assigned E:
but that drive letter may change depending on the system you plug it into, so you need a "constant" drive letter.
the syntax would be
subst.exe P: E:
since you don't know what drive letter your usb drive will be assigned, you replace E: with a relative path "\" the slash indicated the root of the drive.
this is the root of the drive that subst.exe is being run from, so to get the correct drive letter you have to run it from the flash drive.

For those who have fought for it, freedom has a flavor the protected will never know.

"Because they stand on a wall and say, 'Nothing is going to hurt you tonight. Not on my watch.'" (A Few Good Men)
Coincidence is God's way of remaining anonymous.(Albert Einstein)

m2
Offline
Last seen: 11 years 7 months ago
Joined: 2006-12-12 12:00
Sorry, I haven't read the

Sorry, I haven't read the subst's help Wink

But it's easy to obtain the current drive from a launcher. So with just 2 extra lines of code and you can create a command line for subst.
I don't know how is it with bathes, though.

"Those people who think they know everything are a great annoyance to those of us who do." Asimov

SmithTech
SmithTech's picture
Offline
Last seen: 6 months 4 days ago
Developer
Joined: 2006-11-24 18:06
If your launcher will give

If your launcher will give you the drive letter, yes you can replace the / with the drive letter you want to substitute.

Also if your using PStart or ASuite you can just add subst.exe with the appropriate arguments no need for the batch files.

For those who have fought for it, freedom has a flavor the protected will never know.

"Because they stand on a wall and say, 'Nothing is going to hurt you tonight. Not on my watch.'" (A Few Good Men)
Coincidence is God's way of remaining anonymous.(Albert Einstein)

ceciliaFX
ceciliaFX's picture
Offline
Last seen: 1 month 4 weeks ago
Joined: 2007-04-24 14:18
I'm using PStart on a normal

I'm using PStart on a normal (not U3) drive. (I'm very new to this PStart stuff).

So, in the line where I put in arguments should it read:

subst.exe Z: \

I want my drive to be "Z". On my system it is "Z" because I changed it, but whenever I put it in another system it's some random letter. which drives me nuts Sad

"No one man can terrorize a whole nation unless we are all his accomplices." - Edward R. Murrow

"No one man can terrorize a whole nation unless we are all his accomplices." - Edward R. Murrow

iandstanley
Offline
Last seen: 1 year 3 months ago
Joined: 2007-04-20 10:56
other option

Checkout VirtualDrive at https://portableapps.com/node/9691 this sets amoung other things B: to the usb drive - no messing around with subst command.com etc

theoperaghost
Offline
Last seen: 13 years 8 months ago
Joined: 2007-02-17 12:15
Ok, I know i'm a dummy

Hello, Ok, I know i'm a dummy, can you tell me the exact code for the .bat file and what I should call it??

drivep.bat?? does it need to be in the route and not a directory (:/system/drivep.bat)

Ta

Danny

Sing once again with me, Our strange duet, my power over you grows stronger yet,and though you turn from me to look behind, The Phantom of the Opera is there inside your mind....

Just another crazy Phantom fan.

SmithTech
SmithTech's picture
Offline
Last seen: 6 months 4 days ago
Developer
Joined: 2006-11-24 18:06
create a folder on your

create a folder on your flash drive call it Subst it doesn't matter where on the flash drive.
copy subst.exe from \Windows\system32 into the subst folder you created.
create a batch file in the subst folder, call it addp.bat
in addp.bat add the following command.
subst.exe P: \
create a second batch file in the subst folder, call it removep.bat
in removep.bat add the following command.
subst.exe /d P:

run addp.bat to add the drive letter.
run removep.bat to remove the drive letter.

For those who have fought for it, freedom has a flavor the protected will never know.

"Because they stand on a wall and say, 'Nothing is going to hurt you tonight. Not on my watch.'" (A Few Good Men)
Coincidence is God's way of remaining anonymous.(Albert Einstein)

theoperaghost
Offline
Last seen: 13 years 8 months ago
Joined: 2007-02-17 12:15
Can it be made into an .exe

Thanks..

Can it be made as a .exe file so that my U3 will run it on insertion??

I used a program to turn .bat to .exe and your shortcut maker for U3 to add to my U3 Menu but it didnt work. The .exe wanted to run and made C:\ into P:\ as well.

Dan

Sing once again with me, Our strange duet, my power over you grows stronger yet,and though you turn from me to look behind, The Phantom of the Opera is there inside your mind....

Just another crazy Phantom fan.

SmithTech
SmithTech's picture
Offline
Last seen: 6 months 4 days ago
Developer
Joined: 2006-11-24 18:06
It substituted P: for C:

It substituted P: for C: because U3 actually runs its apps from C: rather than the flash drive.

If your using it on a U3 drive and using my shortcut creator.
Put it in a folder on the U3 drive and use the shortcut creator to create a shortcut directly to the subst.exe and pass it the argument of " P: /" without the quotes.
Also set the working directory to the folder were subst.exe is located.
Can't say for sure if it will work, don't have my U3 drive with me today. But it should.
Also you would need to create a shortcut with " /d P:" to remove the substitution when your done.
You might be able to make it one shortcut using the cleanup options of the manifest.u3i but that would require manual editing as the shortcut creator doesn't get that advanced.

EDIT: Try this.
create a folder on your U3 drive called programs,
copy subst.exe to that programs folder.
Run the shortcut creator.
Type in the shortcut name.
check the advanced options button.
make not of where it tells you it created the manifest.u3i file.
open the manifest.u3i file in notepad.
replace it contents with this




  
    
    Substitute Drive
    
    Substitute Drive
    
    
      0
      
    
    
  
  
    /d P:
    
    P: /
  

delete the space after every For those who have fought for it, freedom has a flavor the protected will never know.

"Because they stand on a wall and say, 'Nothing is going to hurt you tonight. Not on my watch.'" (A Few Good Men)
Coincidence is God's way of remaining anonymous.(Albert Einstein)

theoperaghost
Offline
Last seen: 13 years 8 months ago
Joined: 2007-02-17 12:15
Ok, I know i'm a dummy (again)

No Joy, but thanks for the tip, but I can't seem to get it to work.

Danny

Sing once again with me, Our strange duet, my power over you grows stronger yet,and though you turn from me to look behind, The Phantom of the Opera is there inside your mind....

Just another crazy Phantom fan.

SmithTech
SmithTech's picture
Offline
Last seen: 6 months 4 days ago
Developer
Joined: 2006-11-24 18:06
Your not a dummy, my fault,

Your not a dummy, my fault, syntax was wrong.
Use same instructions as above but use this...



  
    
    Substitute Drive
    
    Substitute Drive
    
    
      0
      
    
    
  
  
     /d P:
    
     P: \
  

This time I have my U3 drive and tested it.

For those who have fought for it, freedom has a flavor the protected will never know.

"Because they stand on a wall and say, 'Nothing is going to hurt you tonight. Not on my watch.'" (A Few Good Men)
Coincidence is God's way of remaining anonymous.(Albert Einstein)

theoperaghost
Offline
Last seen: 13 years 8 months ago
Joined: 2007-02-17 12:15
Thanks SmithTech IT WORKS

Thanks SmithTech IT WORKS!!!

You put to remove the spaces before the to make it work.

Clever person and I love ya!!

Sing once again with me, Our strange duet, my power over you grows stronger yet,and though you turn from me to look behind, The Phantom of the Opera is there inside your mind....

Just another crazy Phantom fan.

Simeon
Simeon's picture
Offline
Last seen: 7 years 11 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
Just be careful

if you come along a PC with for example several cd - or network-drives. If one of them already has the drive letter you want your USB to have...

"Physics is like sex. Sure, it may give some practical results, but that's not why we do it." - Richard P. Feynman

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

SmithTech
SmithTech's picture
Offline
Last seen: 6 months 4 days ago
Developer
Joined: 2006-11-24 18:06
I chose P: for 2 reasons. P

I chose P: for 2 reasons.
P for Personal,
and I figured it was far enough down the list it most likely wouldn't run into the problem of a drive already having that letter.
E to O leaves 12 drive letters before P is used.
Honestly though you can't guarantee that any one drive letter will be available on every system you come across. Network admins tend to assign drive letter for the oddest reasons and never in any given order.

For those who have fought for it, freedom has a flavor the protected will never know.

"Because they stand on a wall and say, 'Nothing is going to hurt you tonight. Not on my watch.'" (A Few Good Men)
Coincidence is God's way of remaining anonymous.(Albert Einstein)

m2
Offline
Last seen: 11 years 7 months ago
Joined: 2006-12-12 12:00
At my university, network

At my university, network drives have higher letters. And there's P...

"Those people who think they know everything are a great annoyance to those of us who do." Asimov

BuddhaChu
BuddhaChu's picture
Offline
Last seen: 5 years 11 months ago
Joined: 2006-11-18 10:26
Adapt and overcome

Write a batch file or VBScript/JScript file to check for an unused drive letter and then use that with subst.exe or have the script file assign the drive letter for you.

Cancer Survivors -- Remember the fight, celebrate the victory!
Help control the rugrat population -- have yourself spayed or neutered!

m2
Offline
Last seen: 11 years 7 months ago
Joined: 2006-12-12 12:00
What for? I won't get this

What for? I won't get this letter w/out administrative rights.

I just wanted t say that there's no good letter, it's always better to write a launcher that manually sets path in configuration files, even when it's much more work.

"Those people who think they know everything are a great annoyance to those of us who do." Asimov

SmithTech
SmithTech's picture
Offline
Last seen: 6 months 4 days ago
Developer
Joined: 2006-11-24 18:06
But if those configurations

But if those configurations "file" are in the registry you still need admin rights.
This was easier, I needed a consistant drive letter dreamweaver,I might get around to adding to my Dreamweaver launcher to "edit" its registry entries, right now it just copies them.

For those who have fought for it, freedom has a flavor the protected will never know.

"Because they stand on a wall and say, 'Nothing is going to hurt you tonight. Not on my watch.'" (A Few Good Men)
Coincidence is God's way of remaining anonymous.(Albert Einstein)

AndySmith
Offline
Last seen: 13 years 4 months ago
Joined: 2006-12-08 11:56
On a similar theme

But what can you do if a drive letter is NOT assigned? On several occasions I have plugged in my Portable Apps USB, only to find I have to re-start Windows for a drive letter to be assigned. I tried the batch file mentioned above, but unless I can actually see it how can I run it?
Or am I missing something?

zikarus
Offline
Last seen: 11 years 1 week ago
Joined: 2006-10-10 16:32
I like this a lot - Thx

I like this a lot - Thx SmithTech! For those who do not know which drive letter to use: Try out B. This one should definitely not be used on any newer machines.

arqbrulo
arqbrulo's picture
Offline
Last seen: 2 years 7 months ago
Joined: 2006-08-10 16:38
Yeah

Thanks SmithTech. I'm really enjoying this.
---------------
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
"Sometimes I worry about being a success in a mediocre world." -- Lily Tomlin

"In three words I can sum up everything I've learned about life: it goes on." -- Robert Frost
"In three words I can sum up everything I've learned about life: baby ain't mine." -- Adam Holguin

arqbrulo
arqbrulo's picture
Offline
Last seen: 2 years 7 months ago
Joined: 2006-08-10 16:38
Substitute drives

Hey, I created a small app using AutoIt that once it's run, you can pick a drive letter to substitute your drive using the subst.exe. Since subst.exe is a window's program, my app just runs it from the system32 folder. If there's people here interested in it, let me know.
---------------
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
"Sometimes I worry about being a success in a mediocre world." -- Lily Tomlin

"In three words I can sum up everything I've learned about life: it goes on." -- Robert Frost
"In three words I can sum up everything I've learned about life: baby ain't mine." -- Adam Holguin

Patrick Patience
Offline
Last seen: 2 years 9 months ago
DeveloperModerator
Joined: 2007-02-20 19:26
OMG!

PLEASE YES!

You can e-mail me at mono_purpura(at)hotmail(dot)com if you can't find any hosting, and I can host it on my site for a few days if it's not too big.

_____________________________
I felt so different without a signature.

SmithTech
SmithTech's picture
Offline
Last seen: 6 months 4 days ago
Developer
Joined: 2006-11-24 18:06
I can host it indefinitely,

I can host it indefinitely, you will have to link to its description page though as I am going to be setting up direct file link restrictions soon.

-----------------------------------------------------------------------------------------------
For those who have fought for it, freedom has a flavor the protected will never know.

"Because they stand on a wall and say, 'Nothing is going to hurt you tonight. Not on my watch.'" (A Few Good Men)
Coincidence is God's way of remaining anonymous.(Albert Einstein)

Patrick Patience
Offline
Last seen: 2 years 9 months ago
DeveloperModerator
Joined: 2007-02-20 19:26
Ok, I'm still.

Not completely sure I've got it.

I tried it, and I used drive G, because only it, and my C.D. drive were availible. And it just clones my drive? It can't use C drive, so what so i do to get my programs to run from the System32 folder like you said?

But here's the download link for Arqbrulo's AutoIt program.

Download Substitute Drives

_____________________________
I felt so different without a signature.

Ryan McCue
Ryan McCue's picture
Offline
Last seen: 13 years 1 week ago
Joined: 2006-01-06 21:27
.

Mirrored.
----
Ryan McCue.
Blog.
So all that Airbus-delay trouble over here in Europe is because of YOU!
Simeon.

"If you're not part of the solution, you're part of the precipitate."

Patrick Patience
Offline
Last seen: 2 years 9 months ago
DeveloperModerator
Joined: 2007-02-20 19:26
Thanks Ryan.

I'll take mine down now.

_____________________________
I felt so different without a signature.

SmithTech
SmithTech's picture
Offline
Last seen: 6 months 4 days ago
Developer
Joined: 2006-11-24 18:06
Which drive is it "cloning"?

Which drive is it "cloning"? It should be your flash drive.
Your programs run from the "cloned" flash drive not system32, Arqbrulo's AutoIt program it only to allow running subst.exe from the system32 and not have to copy it to the flash drive.

-----------------------------------------------------------------------------------------------
For those who have fought for it, freedom has a flavor the protected will never know.

"Because they stand on a wall and say, 'Nothing is going to hurt you tonight. Not on my watch.'" (A Few Good Men)
Coincidence is God's way of remaining anonymous.(Albert Einstein)

arqbrulo
arqbrulo's picture
Offline
Last seen: 2 years 7 months ago
Joined: 2006-08-10 16:38
About the program

I really was not ready for a "mass distribution" of my program. First of all, I need to find another icon, or maybe someone could make one. I got the icon it has right now from google-ing. Also, I made a small change. Now it writes to a txt file with the last drive letter used. For example, I always use T:, now, it will remember that.

Also, like SmithTech said, all this handy little app does is run subst.exe from the system32 folder and "clones" your flash drive and appears on "My Computer" as another drive.

Obviously, you have to put it inside a folder within PortableApps in order for it to show up in the PAM.
---------------
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
"Sometimes I worry about being a success in a mediocre world." -- Lily Tomlin

"In three words I can sum up everything I've learned about life: it goes on." -- Robert Frost
"In three words I can sum up everything I've learned about life: baby ain't mine." -- Adam Holguin

ZachHudock
ZachHudock's picture
Offline
Last seen: 4 years 9 months ago
Developer
Joined: 2006-12-06 18:07
It's a great program, works

It's a great program, works well. I like the ideas that you are adding to it. One thing I noticed with it though, No matter where I run it from, flash drive, C drive, on any PC, the initial message is "Choose a drive letter to substitute C: with, the next available drive letter is E:" I tested it on several PCs at my school, and at home, all of which have drive E already present, and I didn't run the app from the C: drive.

The developer formerly known as ZGitRDun8705

arqbrulo
arqbrulo's picture
Offline
Last seen: 2 years 7 months ago
Joined: 2006-08-10 16:38
Hmmm

That's wierd (the C: thing). I'll see what it could be. Now, as far as the E: is concerned; is the E: drive a cd/dvd rom? the app sees if the drive letter exists by doing a "If FileExists(e:\)" so if there's no files in the drive, it will think that it's available. I haven't had time to check into that to correct it. Also, I'll send the new version over to Ryan and Patric so they can upload it to their sites (If you guys don't mind). There are three changes done: First it saves the last used drive letter to a txt file. Second, If the last drive used was Z and it's already taken, it would show "[" or "{" as the next drive letter. I corrected that as well. Third, it starts showing the available drive letters starting from F rather than E to avoid if possible the cd/dvd roms.
---------------
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
"Sometimes I worry about being a success in a mediocre world." -- Lily Tomlin

"In three words I can sum up everything I've learned about life: it goes on." -- Robert Frost
"In three words I can sum up everything I've learned about life: baby ain't mine." -- Adam Holguin

ZachHudock
ZachHudock's picture
Offline
Last seen: 4 years 9 months ago
Developer
Joined: 2006-12-06 18:07
On all the PCs E was a CD or

On all the PCs E was a CD or DVD drive, so i guess that part is explained now. The C: thing im still confused about. Im looking forward to the new features. Thanks for the great app

The developer formerly known as ZGitRDun8705

ghorian
Offline
Last seen: 15 years 5 months ago
Joined: 2007-04-26 08:09
You don't need to carry a copy of subst.exe !

SmithTech wrote:

> Copy subst.exe from windows\system32 to your flash drive.
> create a batch file with the following command.

> subst.exe P: \

You don't need to carry a copy of subst.exe with you. The following bat file does the same thing:

subst P: %~d0\

--
Greg N.

Greg N.

ceciliaFX
ceciliaFX's picture
Offline
Last seen: 1 month 4 weeks ago
Joined: 2007-04-24 14:18
I'm using PStart on a normal

I'm using PStart on a normal (not U3) drive.

Are you saying that if I have PStart start up subst.exe I should include this argument:

P: %~d0\

rather than

P: \

"No one man can terrorize a whole nation unless we are all his accomplices." - Edward R. Murrow

"No one man can terrorize a whole nation unless we are all his accomplices." - Edward R. Murrow

SmithTech
SmithTech's picture
Offline
Last seen: 6 months 4 days ago
Developer
Joined: 2006-11-24 18:06
No he's saying if your using

No he's saying if your using a batch file AND not copying the subst.exe to your flash drive.
If your using PStart to call subst.exe and subst.exe IS on your flash drive you can pass P: \ or P: %pdrive%\

If your using PStart to call subst.exe and subst.exe IS NOT on your flash drive you should pass P: %pdrive%\
P: %~d0\ will not work with PStart
-----------------------------------------------------------------------------------------------
For those who have fought for it, freedom has a flavor the protected will never know.

"Because they stand on a wall and say, 'Nothing is going to hurt you tonight. Not on my watch.'" (A Few Good Men)
Coincidence is God's way of remaining anonymous.(Albert Einstein)

ceciliaFX
ceciliaFX's picture
Offline
Last seen: 1 month 4 weeks ago
Joined: 2007-04-24 14:18
Thanks as i have subst.exe

Thanks

as i have subst.exe on the drive i'll be using the
P: \
style argument.
now to find a friend's computer to torture!
LOL

"No one man can terrorize a whole nation unless we are all his accomplices." - Edward R. Murrow

"No one man can terrorize a whole nation unless we are all his accomplices." - Edward R. Murrow

nocr
nocr's picture
Offline
Last seen: 13 years 10 months ago
Joined: 2007-05-04 11:47
None of this is working for

None of this is working for me.

What am I doing wrong?

I copied subst.exe to my flash drive.
And I also created a batch file named addp.bat with the following command:
subst.exe P: \

I even created the removep.bat batch file, (even though I'm not sure why I'd use it)

And then I ran both of them numerous times, in different orders, while unplugging and plugging in my flash drive to check if they had worked.

Sorry if I come off as a bit of a n00b, but that's what I am.

Oh, and neither of the download links for that program that argbulo made work.

Just thought I'd put that out there.

Please Make TiLP Portable

Wences
Offline
Last seen: 2 years 11 months ago
Joined: 2007-04-17 22:05
Sounds like the current drive's to blame.

The second param for subst.exe is the directory you want to be assigned the drive.

Example:

subst.exe P: "C:\Documents and Settings\wences\My Documents"

and now P: is My Documents (note the "s around the directory, so Windows won't think "C:\Documents" is one thing, "and" is another, etc).

Now when instead of a dir you say "\" as in

subst.exe P: \

it means: "Get the root directory (the dir that contains things that aren't in any dir) for this drive"
So which is "this drive"? There's the rub.

Try this:
* Windows Key + R (or Start ---> run)
* Type "cmd" (without the ")
* Enter
The black window will most probably say:

C:\>

What's before the ">" is your Current Working Directory (cwd). In this case, it's the root dir for C: drive.
Change the drive by typing "X:" (without the ")(Don't use X, use the letter your USB drive has)(And hit [enter], of course).
Now your prompt should be:

X:\>

Now, type "subst.exe P: \" (again, no "). If you didn't put subst.exe "loose" in the drive, but instead inside a dir, you will need to type: "dir\subst.exe P: \".
When you said "X:" you changed your cwd (and drive), so now the root dir of "this drive" is the same as "X:", so you're P: gets to be a synonym of Secret

This is very good as a debugging method, in case there is any mistake in your .bat,
because it will show it on the screen).

If you get a launcher, like ASuite, to launch the .bat file, it will probably launch it with a cwd in the same drive where it (ASuite) resides. But if in doubt, add this line to your .bat (for debugging only, then delete it).

cd > C:\my_cwd.txt

Then run it, and then open the file C:\my_cwd.txt. It will contain the CWD that your bat had when it last run. (you can delete it, it's just to *see* the dir).

King Tut
Offline
Last seen: 10 years 10 months ago
Joined: 2006-06-15 05:47
Not working.. I have the

Not working..

I have the folder 'subst' in the root directory.

In that I have subst.exe, addy.bat and removey.bat.

In addy.bat I have:

subst.exe Y: \

In removey.bat I have:

subst.exe /d Y:

And it doesn't work... I tried addy.bat and nothing happened, tried it again and it said 'Drive already SUBSTed' in the CMD window. Trying removey.bat and then addy.bat doesn't work either...

SmithTech
SmithTech's picture
Offline
Last seen: 6 months 4 days ago
Developer
Joined: 2006-11-24 18:06
did you check to see if Y:

did you check to see if Y: was created?
if you already had explorer open did you refresh the view?

-----------------------------------------------------------------------------------------------
Because they stand on a wall and say nothing is going to hurt you tonight. Not on my watch.

"Because they stand on a wall and say, 'Nothing is going to hurt you tonight. Not on my watch.'" (A Few Good Men)
Coincidence is God's way of remaining anonymous.(Albert Einstein)

Wences
Offline
Last seen: 2 years 11 months ago
Joined: 2007-04-17 22:05
How are you firing them up?

If you just double click the .bat files, the current directory at that moment is... well... pray for an answer, because only God knows what it is. Smile

It is perfectly possible that even though the .bat is in your drive, the Current Working Dir with which it is launched is in C:\

Try putting this in addy.bat:

cd > C:\cwd.txt
subst.exe Y: \

Then run it and then open the file C:\cwd.txt. It will contain the directory from which the bat file was run, which may or may not be the dir where it resides.

If that dir doesn't start with the USB drive's letter, it won't work. Consider using a launcher to start it. It will launch it with a working dir that is on the USB drive.

SmithTech
SmithTech's picture
Offline
Last seen: 6 months 4 days ago
Developer
Joined: 2006-11-24 18:06
I just updated/renamed my

I just updated/renamed my app launcher to Portable Startup Utility and added a substitute drive option.

-----------------------------------------------------------------------------------------------
Because they stand on a wall and say nothing is going to hurt you tonight. Not on my watch.

"Because they stand on a wall and say, 'Nothing is going to hurt you tonight. Not on my watch.'" (A Few Good Men)
Coincidence is God's way of remaining anonymous.(Albert Einstein)

RMB Fixed
Offline
Last seen: 12 years 9 months ago
Joined: 2006-10-24 10:30
Copy ?

quote : "Copy subst.exe from windows\system32 to your flash drive."

Isn't that "illegal" ? (not that I really care but others might)
Other than that : nice little trick you found there, thanks for sharing it Smile

rab040ma
Offline
Last seen: 2 months 1 week ago
Joined: 2007-08-27 13:35
Have people tried using

Have people tried using environment variables with shortcuts?

What I mean is, if PortableApps (or preferably StartPortableApps, or whatever runs first) set an environment variable %pdrive% to "K:" or whatever the drive letter is, what programs would fail to start from a shortcut like

%pdrive%\SomeDirectory\SomeProgram.exe

or that sort of thing?

What other programs are there that absolutely must have the same drive letter each time they are launched, or where the tricks used by John's launcher (rewriting config files to point to the current drive) aren't enough to get it working?

I'm not asserting that there are none, just trying to find some examples.

MC

digitxp
digitxp's picture
Offline
Last seen: 11 years 3 weeks ago
Joined: 2007-11-03 18:33
I don't see...

I don't see any programs here that need specific drive letters. That's an old U3 thing.

Insert original signature here with Greasemonkey Script.

jcoombs
Offline
Last seen: 8 years 5 months ago
Joined: 2007-11-18 11:40
Launchy might benefit from a fixed drive letter

As a delighted Launchy user, I'm interested in using it to launch my portable apps too. Launchy allows me to specify other locations (besides the Start Menu) to be indexed, but if I can't predict the thumb drive's letter, I might have to set that preference every time I plug it in. (Launchy also has a "portable mode", but it doesn't explain what that means.)

http://www.launchy.net/

So, thanks for the helpful BAT file idea!

-Jon

Log in or register to post comments