Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Batch script to run programs with arguments


  • Please log in to reply
3 replies to this topic

#1 Marcio80

Marcio80

  • Members
  • 9 posts
  • OFFLINE
  •  
  • Local time:09:45 PM

Posted 22 March 2011 - 10:16 AM

Hi,
I'm having problems finding the solution of this question.

I'm trying to make a better script (.bat) than this:

flash_player_10.2.152.26.exe
AdbeRdr940_pt_br.exe /sPB /rs
jre-6u24-windows-i586-s.exe /passive /norestart

As these software are updated frequently, I'm trying to use wildcards, but windows doesn't seen to like it:

flash_player_*.exe
AdbeRdr*.exe /sPB /rs
jre-*.exe /passive /norestart

Is it possible to script something like it?

Thanks in advance.

BC AdBot (Login to Remove)

 


#2 PropagandaPanda

PropagandaPanda


  • Malware Response Team
  • 10,433 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:08:45 PM

Posted 22 March 2011 - 06:33 PM

Hello.

In your second sample of code, you are trying to run all the files matching the pattern with those arguments?

If so, you need to look into looping. See here:
http://www.computerhope.com/forhlp.htm

You can use the DIR command to list files based on a pattern, then use FOR to loop through them.

With Regards,
The Panda

#3 Marcio80

Marcio80
  • Topic Starter

  • Members
  • 9 posts
  • OFFLINE
  •  
  • Local time:09:45 PM

Posted 23 March 2011 - 07:10 AM

In your second sample of code, you are trying to run all the files matching the pattern with those arguments?


Uh, you gave me an idea. Write a script that will "dir" the folder than write another script with all the arguments. :)

But is it possible to pass wildcards to run programs?

#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:06:45 PM

Posted 23 March 2011 - 03:12 PM

But is it possible to pass wildcards to run programs?

Depends on the program. Did you really mean to ask "Can I use wildcards in batch scripts?"




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users