Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Messy Autorun + Batch Files  (Read 3619 times)

0 Members and 1 Guest are viewing this topic.

Ryder17z

    Topic Starter


    Intermediate
  • Thanked: 2
    • Yes
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 10
Messy Autorun + Batch Files
« on: May 14, 2008, 10:54:34 AM »
Well I have some exprience in programming, but it doesn't help me here...

I'm pretty familar with GML, Java, C++, HTML and Batch

Here is what the current Autorun.inf does :

  • Plug in an usb-stick
  • The Autorun.inf loads CFG.BAT

Autorun.inf Contains :
Code: [Select]
[autorun]
ICON=1.ico
OPEN=CFG.bat

CFG.BAT swaps icons for the device

My question is :

How do I make the CFG.BAT execute only once - Even if I try to autoplay it  ?

And if I try to autoplay it, I would just get a new window showing the device - How to do that ?

The cake is a lie...

Ryder17z

    Topic Starter


    Intermediate
  • Thanked: 2
    • Yes
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 10
Re: Messy Autorun + Batch Files
« Reply #1 on: May 15, 2008, 10:09:35 AM »
Darn, I really need to know how :-\
The cake is a lie...

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: Messy Autorun + Batch Files
« Reply #2 on: May 19, 2008, 10:41:29 AM »
have the batch file create a "flag" file on the key drive, and check for it's existence when it starts, and if so, quit. Of course this means it would only execute once during it's lifetime...

but to simply get a new window showing the device, either execute "explorer ." in cfg.bat, or as the RUN= line.


Also, under what circumstances does it swap icons?
I was trying to dereference Null Pointers before it was cool.

Ryder17z

    Topic Starter


    Intermediate
  • Thanked: 2
    • Yes
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 10
Re: Messy Autorun + Batch Files
« Reply #3 on: May 20, 2008, 09:39:30 AM »
Well my intention was to swap the icons when I connect it

But I don't get the "flag file" thing


Could you tell me more ?
The cake is a lie...

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: Messy Autorun + Batch Files
« Reply #4 on: May 20, 2008, 01:58:17 PM »
Oh I'm sorry- a "flag" file would just be a file you create in the CFG.bat on the key- it doesn't matter whant you call it or what is in it, because the batch file will simply be testing for it's existence when it first starts. If it exists, then it had been executed.

The problem is it doesn't really work, since you want it to run the autorun code everytime it in plugged in. In this case it will only work the first time.
I was trying to dereference Null Pointers before it was cool.