Batch file that runs upon accessing folder - windows

I'm wondering if it's possible to have a batch file that automatically executes when I open a directory. I have no clue as to how this would be done.
I want it to do this whether it is accessed through cmd/.exe/.bat/mouse

No. This isn't possible using a batch file. (In fact, I don't think it's possible at all without writing a shell extension, which would require an actual programming language.)

Related

Is there a way to find out the location that the executable file is being run from during runtime?

I am attempting to create a program that places a copy of itself into the windows start-up folder. if the program is being run from anywhere that isn't the start-up folder, I would like the program to add the users username to a text file where the original .exe is. hence I need a way to tell where the program is being run from. is there any inbuilt functions in the default units or will I have to write my own function? if so how would I accomplish this?
ParamStr(0) will get you the full path and application name.
Disclaimer: This could be invalid for some OS implementations.

Python: Make a file temporarily unexecutable

I'm writing a simple antivirus that checks for very specific files and patterns, and something I want to implement is a way to make a named file unexecuteable. By this I mean that the computer will realize that the file exists, and has a file extension that would usually launch an application or it's own code, but will not be able to execute it until the user gives the ok.
So given the filename, how could I make a file unable to be executed by the windows operating system?

Prevent Program (.exe) from starting DIRECTLY (Only allow execution from shortcut)?

Is there a way to prevent direct startup of a .exe program, and only start up when a shortcut is run? I'd like this to work also when opening up a filetype that is assigned to a program.
The only thing that comes close to what you want is checking for certain command line parameters. This is actually a rather common way for concealed executions - for instance programs that want you to run a loader program first (online games would be an example).
So you would have to generate a shortcut that privdes the specific command line arguments needed for the start. This ensures that your exe cannot be executed directly, however there are no guaranties that a specific shortcut file is startet as it only provides a link to the exe file.
No, that is not possible, in my knowledge.
This is not possible, the shortcut is executing the program in its location. The .exe has to be executable for the shortcut to work. Assigned file extensions also execute the actual .exe the shortcut is just a symbolic link to the actual file.
If you can give more information as to what your trying to accomplish I could maybe offer another solution.
I'm not aware of any way built in to do this, as an executable is still launched as that user by the shortcut. You can disable shortcut locations, allow only certain executables, etc but not deny access to executable but also allow it via shortcut.

How to zip a file in windows shell without vb script and with Window default zip only

Is their a way to zip a file without VB Script.I got a lot of examples on web to zip file or folder using vbs but i want to do it in a single BAT file.
Yes and no. There is no built in way to do this inside windows. You can use a external application like vbscript, a exe file like 7zip, rar, lots of resources can do this. Since windows is application poor when it comes to command lines is not really surprising. But no you do not need the VB Script for anything.
Just not so easy out of the box. Maybe makecab could do it for you? As a general rule you have a hard constraint in your question. A single BAT file which in general can not do almost anything without the support of hundreds of preinstalled or commonly installed other applications.
Could you specify a the constraints a bit better. Tel WHY you need this particular constraint? And what does it mean as even most of the bat command you use require more than one file.

Building a Visual Basic script that uses a batch file

I've written a batch file script that takes an image sequence from a certain folder, converts it to quicktime using ffmpeg and then it moves the file to a certain folder.
I used variables at the beginning of the batch script for user input on which folder to take the files from.
And now for my question: The batch I've written works just fine but I want to make it into a simple visual basic script so it looks nice and clean instead of a command prompt interface.
Can anyone provide me with tips for the VB code?
How do I pass variables from VB to the batch file?
Any help on this would be much appriciated.
Use a HTML Application to program the GUI to gather the info needed from the user. Use WScript.Shell's .Run or .Exec method to start an external process (either the .bat or ffmpeg directly) and pass those info via the command line.

Resources