Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 1 more developer from Canada and 12 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


About bat files


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 belfegor   Crossbones+   -  Reputation: 2799

Posted 20 December 2012 - 12:09 PM

I downloaded nvidia texture tools command line utilites to be able to convert some textures to "bump maps". The problem is that it will take to long to do it by hand for all images, so i tried to automate it with bat, but my knowledge for command line sintaks is limited:

for %%X in (*.dds) do nvcompress -tonormal %%X %%X_bump.dds
Last parameter is out file name.

If i have input images in that directory:
Image1.dds
Image2.dds
Image3.dds

Output will be:
Image1.dds_bump.dds
Image2.dds_bump.dds
Image3.dds_bump.dds

But i want to remove first extension so that output would be:
Image1_bump.dds
Image2_bump.dds
Image3_bump.dds

Help.

Thank you for your time.

EDIT: Solved. Last param should be:
%%~nX_bump.dds

Edited by belfegor, 20 December 2012 - 12:34 PM.


Sponsor:

#2 fastcall22   Crossbones+   -  Reputation: 6262

Posted 20 December 2012 - 01:04 PM

Windows Vista or later? Learn and use PowerShell. It's seriously amazing:
get-childitem '*.dds' | foreach-object {
    & .\nvcompress -tonormal $_.Name $_.Name "$($_.Name)_bump.dds"
}

Works with .NET, so you can load almost every assembly and directly work with it in PowerShell.

</advertisement>
gzip: H4sIAAAAAAAEAG1QTUvEMBC991e8nvaiFfYoS7yo sLCo6MnjtJ1ugmkiyWRL/72z3T1YEQIJ8z4zA2Xp yPvt1qBpGrRFIJZkk9FyRyUzHCbKIHgn4hnZOrm1 TD0mG0HCCs+QGDGWziKXI6Wm2n++GYwUVH2mrGEE PnGCVQ8K8+JYfXA6URDEQfMZh5h6g5eoAlWJdeEI bbH2qYZf7XMUfw8f/Q0oMeZYNL9/WHF0uFEshvMr XYujd9SycFb+F18QcSOvlJauZ8ejqevdnV7/d550 e0t6prmunh73Bu+vz4c/XUeOQXfJgvKNkhf95U8/ Dtgmy5IBAAA=

#3 tstrimple   Prime Members   -  Reputation: 1755

Posted 20 December 2012 - 03:20 PM

Windows Vista or later? Learn and use PowerShell. It's seriously amazing:


And seriously verbose! It's very painful to use from the command line, but it's great for scripting tasks.

#4 fastcall22   Crossbones+   -  Reputation: 6262

Posted 20 December 2012 - 04:18 PM

And seriously verbose! It's very painful to use from the command line, but it's great for scripting tasks.

It doesn't need to be verbose; that's what aliases are for:
ls *.dds |%{$a=$_.Name;&.\nvcompress -tonormal $a $a "$($_.FullName)_bump.dds")}

gzip: H4sIAAAAAAAEAG1QTUvEMBC991e8nvaiFfYoS7yo sLCo6MnjtJ1ugmkiyWRL/72z3T1YEQIJ8z4zA2Xp yPvt1qBpGrRFIJZkk9FyRyUzHCbKIHgn4hnZOrm1 TD0mG0HCCs+QGDGWziKXI6Wm2n++GYwUVH2mrGEE PnGCVQ8K8+JYfXA6URDEQfMZh5h6g5eoAlWJdeEI bbH2qYZf7XMUfw8f/Q0oMeZYNL9/WHF0uFEshvMr XYujd9SycFb+F18QcSOvlJauZ8ejqevdnV7/d550 e0t6prmunh73Bu+vz4c/XUeOQXfJgvKNkhf95U8/ Dtgmy5IBAAA=

#5 Sik_the_hedgehog   Crossbones+   -  Reputation: 2214

Posted 20 December 2012 - 05:28 PM

Ow, that reminds me of Unix shells (though those are still worse when it comes to legibility).
Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS