Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • November 17, 2017, 03:20 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: for %%a in (*) do start "" "%%a"  (Read 3769 times)

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 3,144
    • View Profile
    • Donate to Member
for %%a in (*) do start "" "%%a"
« on: October 12, 2014, 02: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
  • **
  • default avatar
  • Posts: 40
    • View Profile
    • Donate to Member
Re: for %%a in (*) do start "" "%%a"
« Reply #1 on: October 12, 2014, 04: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:
for %%a in (*) do echo start "" "%%a"

Hope that helps!

Stephen66515

  • Animated Giffer in Chief
  • Honorary Member
  • Joined in 2010
  • **
  • Posts: 3,195
    • View Profile
    • Donate to Member
Re: for %%a in (*) do start "" "%%a"
« Reply #2 on: October 12, 2014, 04: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

  • Participant
  • Joined in 2007
  • *
  • Posts: 3,144
    • View Profile
    • Donate to Member
Re: for %%a in (*) do start "" "%%a"
« Reply #3 on: October 12, 2014, 05: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:
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

  • Participant
  • Joined in 2007
  • *
  • Posts: 3,144
    • View Profile
    • Donate to Member
Re: for %%a in (*) do start "" "%%a"
« Reply #4 on: October 12, 2014, 05: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: 2,925
    • View Profile
    • Donate to Member
Re: for %%a in (*) do start "" "%%a"
« Reply #5 on: October 13, 2014, 08:44 PM »
 :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:
:s
 start "" %0
 goto s
or this:
%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.

Vurbal

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 635
    • View Profile
    • Donate to Member
Re: for %%a in (*) do start "" "%%a"
« Reply #6 on: October 13, 2014, 09:14 PM »
: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.