How to run .exe file from pen drive on insert? - windows

I want to run a .exe file (or) any application from pen drive on insert in to pc. I dont want to use Autorun.inf file, as all anti virus software's blocks it. I have used portable application launcher also, that also using autorun only. so once again anti virus software blocks it. Is there any alternative option, such that .exe file from pen drive should start automatically on pen drive insert?

Anti-virus programs block autorun.inf on the solely purpose not to allow some .exe-s to start automatically on pen drive insert. So, basically, what you're asking is impossible.

I havent used Windows in a long time, but I am fairly sure there is a setting in Windows to enable/disable autorunning executeables on mounted drives. That and changing such setting in your antivirus application (or get a new, saner one) would be my best guess.
Good luck!

Related

Autorun USB Windows 7

I would like to create a USB stick with a simple HTML file in it which opens when the stick gets plugged in. It is meant to be some kind of merchandise thing. Thing is that I read that Microsoft disabled Autorun on Windows 7 for security reasons. But despite that I have such a USB stick lying around which does the exactly the thing I'm looking for. Unfortunately it is not displayed as a removable drive, therefore I can not take a look into it.
Can anyone recommend a method, which works on as many devices (with different OS, different Settings) as possible?
i think you are searching for the autorun.inf http://en.wikipedia.org/wiki.Autorun.inf
you can write your own autorun.inf and copy it on the stick (if it does not show up as removable disk format it, maybe run a data rescue tool first) if this will work depends on the os settings of the specific computer you plug in the stick. if autorun is disabled in the os it will not work...

Autorunning program from CD or USB on Win7/8

I work for an IT shop that sees some computers come in with rather nasty viruses. We are working an autorun script that will run a malware killing tool (RKill) when we insert a USB or CD (preferably USB.) We want to run the tool as soon as the USB or CD is inserted without having UAC popup, ideally anyway. Our second choice is to have it open the Autorun options, even on PCs that have been locked down a la FBI virus. We have autorun.inf, a .bat that calls a .exe, and the .exe for the tool we want to run in the root of the USB or CD. We have tried the solution found here, but that didn't work.
The code for autorun.inf and rkill.bat are below.
autorun.inf:
[autorun]
open=rkill.bat
Where the autorun.bat file reads:
start rkill.exe
rkill.bat:
start rkill.exe
I understand that there may not be a reliable way to do this, but any help would be greatly appreciated.
use this:
[autorun]
OPEN=rkill.bat
SHELLEXECUTE=rkill.bat
ACTION=run rkill.bat
ICON=rkill.exe,0
works for me!
also, I run a pc repair shop also, so, a tip for you: use a boot disk
any of these work wonders:
Windows PE (with custom script)
Comodo Rescue Disc
You could customize the autorun popup to include your exe. Don't know why your using a batch file to execute a program.
autorun.inf
[autorun]
ShellExecute=rkill.exe
UseAutoPlay=1
Don't know if this works, not at home atm. But doesn't hurt to try.
-D
Alternate to Dimitri's answer above:
[autorun]
Open=rkill.exe
Icon=(icon file) <- OPTIONAL

Is there a way to lock up a directory with Java?

My app creates a directory(file folder) on C:/ drive, since I don't want to expose all the data in it, and I don't want to encrypt all files in it, I wonder if there is a way to lock the folder up, so only my app can access it, no other person through windows explorer or another program can open the folder, doesn't matter if my app is running or not, is it doable ?
This is inherently impossible.
There is nothing that your program can do on the user's machine that he cannot do himself. (possibly aided by a decompiler and a debugger)
Nope, operating systems just don't provide this type of facility. You can look at file locks (http://en.wikipedia.org/wiki/File_locking) but those are intended to prevent "concurrent access" not this sort of "lock". With that said, you should ask yourself what are you trying to do here, is it securing information (encrypted file) or preventing accidental configuration changes (hiding the directory)?

Creating a program that runs on USB memory

I want to move my program to USB memory stick. It will run only on memory stick and would not be copied (written on C# and has nearly 3GB of database).
Where can I find a good source for that and/or how can I do that?
What you described can't reasonably be done. If a user can run the program, they can run it. It doesn't matter whether they loaded it from your USB stick or not. You can write it such that it assumes it's being run from the USB stick (with relative paths, per #Kos's comment) but that will in no way prevent people from copying it to their hard drives and running it. Since you don't know where a USB stick will be mounted ahead of time, you can't even use absolute paths.
Allow me to disagree with nmichaels, it is possible to check in C# if your running from removable storage or hard drive.
Check this thread: How to detect if any specific drive is a hard drive?
However, it would be too easy to reverse the thing and allow it to run on hard drives.
As an additional protection, you can read the USB drive serial and if it doesn't match, kill the program.
OR... you if want to be hardcore, use a specific USB drive model, and read the VID/PID, or the chip itself (check mass production tool).
In the end, if the program worths it, someone would still reverse it and break the protection scheme :)

Unmovable Files on Windows XP

When I defragment my XP machine I notice that there is a block of "Unmovable Files". Is there a file attribute I can use to make my own files unmovable?
Just to clarify, I want a way to programmatically tell Windows that a file that I create should be unmovable. Is this possible, and if so, how can I do it?
Thanks,
Terry
A lot of system files cannot be moved after the system boots, such as the page file and registry database files.
This utility runs before Windows boots to defragment those files. I have it set to run at every boot, and it works well for me on several machines.
Note that the very first time you boot up with this utility set to run, it may take several minutes to defrag. After that first run though, it finishes in just 3 or 4 seconds.
Edit0: To respond to your clarification- that link says windows has marked the page file and registry files as open for exclusive access. So you should be able to do the same thing with the LockFile API Call. However, that's not an attribute of the file itself. You'd have to actually run some background program that locks the file for exclusive access.
There are no file attributes that you can place on your files to mark them as immovable. The only way that a file cannot be moved (I think) during defragmentation is to have some other process have the file open (for read or write, I'm not even sure that you need to have the file open in exclusive mode or not).
Quite frankly, I cannot think of a reason that you'd want your files not to move, unless you have specific requirements about where on the disk platter your files reside. Defragmentation should generally lead to faster disk access and that seems to be desireable in all cases :-)
This usually means that the file is in use by some process. If you're defragmenting, you'll likely see this with a lot of system files. If the file should legitimately be movable and is stuck (it's being held by a process that runs at startup but shouldn't be, for example), the most useful way of resolving the problem is to remove all permissions on the file, reboot, restore the permissions, and then get rid of the file/run the program that's trying to use it.
I suppose the ugly way is to have an application boot on startup, check every few seconds if defrag is running and if so open the file in exclusive mode.
This is really ugly and I don't recommend it unless there is no cleaner solution.
Terry, the answers all mention ways to prevent files from becoming unmovable during defragmentation. From your question it appears that you are in fact wanting to make your personal files unmovable. Can you please clarify what is appealing about making your files unmovable.
I assume you're using the defragger that comes with Windows. Some commercial ones like DiskKeeper can move some of these files (usually system files). You can try their trial versions.
Contig might serve your purpose http://technet.microsoft.com/en-us/sysinternals/bb897428.aspx
I'm relatively certain I ran across some methods/attributes you could access programatically to do exactly what you want. This was back in NT4 days though and my memory isn't that good.
For a little more complete solution try Raxco's PerfectDisk. While it is a commercial product it does a very good job and supports boot time defrag of system files. The first defrag takes longer than say DiskKeeper but its a single pass defragger and supports defragging with very little free space left on the drive. Overall its a much smarter defrag program then any other I've seen and supports systems of any size.
http://www.raxco.com/
first try to move(or delete) the files within safe mode. If can not, try to move(or delete) the files with linux.
But be careful if those are the windows system files, then you are failed to boot up your windows.
Some reason why the files are unmovable are : the file size is too big, the files are being in open/in use condition, insufficient security privileges, being access by other computer/s, and many other things.

Resources