1

How do I move filename to bar.filename without mentioning filename twice?

In Bash I can just do: mv {,bar.}filename. I suppose I could do:

set filename="foobar" && mv "%filename%" "bar.%filename%"

But that seems overly verbose. Could write a function also, but that seems overkill:

@echo off & setlocal ENABLEEXTENSIONS
set str="%1"
call :move %str%

:move
mv/%1/bar.%1
2
  • I'm not a Batch expert, but something looks amiss with your set filename=... line: shouldn't that be set foobar=...?
    – BenjiWiebe
    Dec 27, 2014 at 5:10
  • I don't know such way in DOS or PowerShell and I doubt it exists. I suggest to install Git, as it includes Bash, which is just wonderful
    – janos
    Dec 27, 2014 at 10:21

0

You must log in to answer this question.

Browse other questions tagged .