Running a consol application from batch file

Acer / Acer power series
January 25, 2010 at 03:50:07
Specs: Xp, 2GB RAM
I want to run a consol application from a batch file which needs to run when a usb is plugged in. the batch file is to be in the usb.
i have written the batch file as autoexec.bat. and saved in the usb. But when the usb is plugged in, this batch file is not running automatically.
Here is the content of my autoexec.bat


@echo off
ConsoleApplication1

What else i need to add to make the option show , run autoexec.bat when a usb is plugged in


See More: Running a consol application from batch file

Report •


#1
January 25, 2010 at 07:05:22
Oh, wow. Autoexec.bat. That takes me back a good, well, almost 20 years.

What you need is a viable autorun.inf.


Report •

#2
January 25, 2010 at 21:14:43
I have written an autorun.inf

[autorun]
open=ConsoleApplication1.exe

But this still didnt run the program on start up


Report •

#3
January 25, 2010 at 22:27:06
I read that from usb, the autorun.inf file wont be running automatically from windows 7.
If that is the case, how can i launch the application in usb without user interaction

Report •

Related Solutions

#4
January 26, 2010 at 03:39:14
Assuming the default registry settings are in play, you can't. Otherwise, you could get a virus by plugging in a thumb drive, just like you could get the Sony rootkit virus by putting in one of their CDs.

Report •

#5
January 26, 2010 at 09:03:21
I think autorun.inf only works for CD's/DVD's/BluRay's

God, what may happen when you put it on USB drives ... the horror !

Autoexec ... isn't that obsoleted (FINALLY) since XP ? Hmm, lets's see

attrib -r -h -s C:\autoexec.bat
echo echo Hey dude, I'm still there >> C:\autoexec.bat
echo pause >> C:\autoexec.bat
attrib +r +h +s C:\autoexec.bat
shutdown.exe -r


Report •

#6
January 26, 2010 at 09:33:09
tvc: Autoexec ... isn't that obsoleted (FINALLY) since XP ?
Parsing the autoexec.bat file has always been optional in the WinNT line, and it does by default. (Really, if you think WinXP changed something, it's probably been around much longer.)

Report •

#7
January 26, 2010 at 09:52:00
What I mean is that since XP, the C:\autoexec.bat ends up being 0 bytes as standard, unlike with W98 ?!

Report •

#8
January 26, 2010 at 09:54:51
Well, if you're asking if autoexec.bat is required to configure the computer at boot, then no. Autoexec.bat was never required for WinNT.

Also:
1) Connect a USB drive
2) Copy explorer.exe to that drive's root
3) Add an autorun.inf with the following:

[autorun]
icon=explorer.exe,9
4) Eject/Reinsert the USB drive

Report •

#9
January 26, 2010 at 10:05:36
Finally,
Can we use autorun.inf in a usb which is going to be plugged to a windows 7 OS?.
i Heard that we can manualy make this setting in windows 7, but how?

Report •

#10
January 26, 2010 at 10:22:14
I don't know of any changes to autorun.inf's parsing between Windows versions, but details of the registry keys in question can be found in MS support article KB967715.

Report •

#11
January 26, 2010 at 23:15:39
i have written the autorun.inf file to a CD along with the application. When i inserted the CD, the autoplay window came along with the option to select run exe. the program didnt run automatically without the user selecting the option to run it..
What i need is something like when a cd is inserted, open up the application which is given in the autorun.inf without any pop up of the selection window

Report •

#12
January 27, 2010 at 02:26:38
I guess it's just an option in Windows, to tell it to run automatically, and not ask a stupid question first ... use Windows Help or Google

for example: http://autorun.moonvalley.com/autor...


Report •

#13
January 27, 2010 at 04:02:39
hellodos: What i need is something like when a cd is inserted, open up the application which is given in the autorun.inf without any pop up of the selection window
Yeah, Microsoft removed that from all current versions of Windows; it was being abused too much.

Report •

#14
January 27, 2010 at 04:39:56
Yes, instead of writing an OS that gets better protected when running non-administrator programs, they decided to go for the lame solution, and prevent (automatic) running of the programs alltogheter. They then ask the user to tell them if the program is safe or not ... it means total failure of the protection layer of the OS itself. The message should be : "This OS is so crappy it does not know this is harmful or not, and to protect our instable system, we don't allow to run any program, unless YOU tell us to run it. So, do you want to run it : yes/no ?"

Report •

#15
January 27, 2010 at 05:32:20
tvc: it means total failure of the protection layer of the OS itself.
I'm all for MS bashing, but I do expect them to be backed by something other than blind nerd rage. Out of curiosity, how would you detect if the autorun program was harmful or not?

Report •

#16
January 27, 2010 at 06:53:52
Well, that is the WRONG question to ask. Do you think it is "normal" that any account on a computer can run dangerous commands like FORMAT, FDISK, etc. ?

You could made up a list of potential dangerous commands, and then you have the answer on your question.

But, you could of course not scan on these commands (in a batchfile) and just prevent these COMMANDS from being run by any stupid account, in the first place.

Because, you can SCAN (a batchfile) and PREVENT to run this batchfile as much as you want ... if you open Start\Run, and then just run the same commands (which are stored in the batchfile you prevented to run earlier) ...

... well, what kind of protection do you then have ?

This is a retorical question, you can answer to it if you want, still.

;)


Report •

#17
January 27, 2010 at 07:10:08
Do you think it is "normal" that any account on a computer can run dangerous commands like FORMAT, FDISK, etc. ?
Nope, nor can you. Unless you're going against all advice (both from MS and third parties) and you're running as an administrator. It's a little like playing with fire in a coal mine.

well, what kind of protection do you then have ?
The retarded kind, which is why MS recommends white-listing over black-listing.

Also, thanks for ignoring the original question. Should I just assume you don't have an answer, so you chose to deflect?

And why do you have such an obsession with batch scripts?


Report •

#18
January 28, 2010 at 03:05:49
> Should I just assume you don't have an answer,
> so you chose to deflect?
>

I have an answer, but you fail to understand it ... not my problem.

Don't give me that crap about MS advice. Do you work at Microsoft, or are you a lawyer ? Good solutions are enforced, not advised.


Report •

#19
January 28, 2010 at 09:07:48
We move onto personal attacks. Awesome.

You're a good kid and all, but your typing outpaces your experience. Really, you just need to slow down a bit, and you won't find yourself in these situations.


Report •

#20
January 31, 2010 at 00:18:51
I wont say that batch file is that outdated.
Lets say, i f you want to do a backup daily , then it is better to write a batch file and schdeule it , rather than writiting a a program to do this..

Report •

#21
February 1, 2010 at 07:33:35
Whatever dude

Report •

Ask Question