MSFN Forum: batch command help - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

batch command help Rate Topic: -----

#1 User is offline   balanel 

  • Group: Members
  • Posts: 2
  • Joined: 29-December 11
  • OS:none specified
  • Country: Country Flag

Posted 29 December 2011 - 06:32 AM

hi

how can i run a batch that ends with "_1" or a batch that contains "_" for example from another batch file


abcd_1.bat or abcd_efgh.bat, abcd and efgh can be anything

10x

This post has been edited by balanel: 29 December 2011 - 06:33 AM



#2 User is online   iamtheky 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 843
  • Joined: 11-November 08

Posted 29 December 2011 - 09:37 AM

to run "abcd_efgh.bat", "abcd_1.bat" would consist of:

@echo off
"abcd_efgh.bat"



**That seems fairly straight forward, works without quotes, what error were you receiving that leads you to believe the underscores are the issue?

This post has been edited by iamtheky: 29 December 2011 - 09:41 AM


#3 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,195
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 29 December 2011 - 12:15 PM

@FOR /F "TOKENS=*" %%# IN ('DIR/B/A-D *_*.BAT') DO @(CALL "%%#")


#4 User is online   iamtheky 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 843
  • Joined: 11-November 08

Posted 29 December 2011 - 12:51 PM

Awesome Yzowl, batches are your biatch :thumbup

i learn something everytime you post.

#5 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,195
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 29 December 2011 - 03:29 PM

Please remember that there is a more simple method too:
@FOR %%# IN (*_*.BAT) DO @(CALL "%%#")
I posted the former because as a for loop 'command' rather than 'file set' you have more control over the variables, (and they're easier to maintain), simply by changing the contents of the loop or the tokens/delimiters rather than parsing through resulting variables with extra code later.

#6 User is offline   balanel 

  • Group: Members
  • Posts: 2
  • Joined: 29-December 11
  • OS:none specified
  • Country: Country Flag

Posted 04 January 2012 - 03:12 AM

thanks for help, works ok

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy