DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: for %%a in (*) do start "" "%%a"  (Read 16,665 times)

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
for %%a in (*) do start "" "%%a"
« on: October 12, 2014, 07:55 PM »
What exactly does this line of batch code ? :

for %%a in (*) do start "" "%%a"


I don't recommend to use.
Collapse two times my system.

:-[

lujomu

  • Member
  • Joined in 2008
  • **
  • Posts: 40
Re: for %%a in (*) do start "" "%%a"
« Reply #1 on: October 12, 2014, 09:41 PM »
It launches EVERY file and folder in the current directory.
I.e. it runs every executable or script files, opens every other file in its respective app and opens an explorer window for every folder.

A little trick to identify what a loop actually does is to insert the word "echo" after "do". This will print out each command instead of executing it:
Code
for %%a in (*) do echo start "" "%%a"

Hope that helps!

KynloStephen66515

  • Animated Giffer in Chief
  • Honorary Member
  • Joined in 2010
  • **
  • Posts: 3,772
    • Participated in NANY Challenge Three Times
    • Cody Award
    • Coding Snacks
    • Official Forum Clown
    • Volunteers/Staff
    • Writer
    • Hardware Hacker
    • DJ Badge - DJ
    • Linux User
Re: for %%a in (*) do start "" "%%a"
« Reply #2 on: October 12, 2014, 09:45 PM »
What exactly does this line of batch code ? :

for %%a in (*) do start "" "%%a"


I don't recommend to use.
Collapse two times my system.

:-[

So you ran a batch file that you didn't have clue what it did?    Seems like a totally reasonable and safe things to do...lmao

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: for %%a in (*) do start "" "%%a"
« Reply #3 on: October 12, 2014, 10:18 PM »
It launches EVERY file and folder in the current directory.
I.e. it runs every executable or script files, opens every other file in its respective app and opens an explorer window for every folder.

A little trick to identify what a loop actually does is to insert the word "echo" after "do". This will print out each command instead of executing it:
Code
for %%a in (*) do echo start "" "%%a"

Hope that helps!


But really don't go.
I try and collapse also with an execution from a folder containing eight urls and collapsed.

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: for %%a in (*) do start "" "%%a"
« Reply #4 on: October 12, 2014, 10:37 PM »
Ejem I tried because comes in a forum for years i use, but not always
What exactly does this line of batch code ? :

for %%a in (*) do start "" "%%a"


I don't recommend to use.
Collapse two times my system.

:-[

So you ran a batch file that you didn't have clue what it did?    Seems like a totally reasonable and safe things to do...lmao

I try because was posted in a forum i visit several years ago....

:-[

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,027
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Linux User
Re: for %%a in (*) do start "" "%%a"
« Reply #5 on: October 14, 2014, 01:44 AM »
:nono2:

The best advice ever when running random code posted in a forum, is exactly as Stephen alluded to:
NEVER run code that you don't know what it is going to do.  Perhaps you wanted to run this script because you saw it as a batch-bomb of sorts, and wanted to look into how to prevent it from crashing your system.  But not knowing?... just don't do it.

For example, DON'T run this:
Code
 :s
 start "" %0
 goto s
or this:
Code
%0|%0
until you know what it does, and how to stop it.  And now that you've seen the code, you'll be able to spot it in the wild.
You're welcome.
All children left unattended will be given a mocha and a puppy.

Vurbal

  • Mostly harmless
  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 653
    • Writer
Re: for %%a in (*) do start "" "%%a"
« Reply #6 on: October 14, 2014, 02:14 AM »
:nono2:

The best advice ever when running random code posted in a forum, is exactly as Stephen alluded to:
NEVER run code that you don't know what it is going to do.  Perhaps you wanted to run this script because you saw it as a batch-bomb of sorts, and wanted to look into how to prevent it from crashing your system.  But not knowing?... just don't do it.

At the very least run it in a vm. I can understand if you're the type of person who needs to see something in action to understand it. Given that it's both easy and free to do it safely, when somebody who ought to know better chooses to play Russian roulette, I have to think they're getting what they deserve.

I learned to say the pledge of allegiance
Before they beat me bloody down at the station
They haven't got a word out of me since
I got a billion years probation
- The MC5

Follow the path of the unsafe, independent thinker. Expose your ideas to the danger of controversy. Speak your mind and fear less the label of ''crackpot'' than the stigma of conformity.
- Thomas J. Watson, Sr

It's not rocket surgery.
- Me


I recommend reading through my Bio before responding to any of my posts. It could save both of us a lot of time and frustration.

Original address: https://www.donationcoder.com/forum/index.php?topic=39236.0