Replace content in bat files RRS feed

  • Question

  • Hi All I have set of bat files. Following highlighted text are common to all bat files. sqlcmd -S ADC012-PC1\SQLExpress -d test -i E:\Reports\SQLtemplates\R0001.sql -o E:\Reports\Output\R0001.csv -s"," All bat files are stored in a E:\Reports\BatFiles folder. I want to do following things using a new bat file. 1. Create new folder in E:\Reports. new folder name is 2011. And also two folders which are called BatFiles and Output folders should be created within the 2011 folder. (i.e E:\Reports\2011\BatFiles and E:\Reports\2011\Output 2. Copy all bat files which are stored in E:\Reports\BatFiles folder to E:\Reports\2011\BatFiles folder 3. Then replace "E:\Reports\Output\ " text into "E:\Reports\2011\Output\" in every bat file content. Please advice me how to achieve my requirements. Thank You
    Friday, February 18, 2011 9:15 AM


  • Hello ... again.

    You should better post your question to a more related forum; this got nothing to do with Transact-SQL.

    Have a look at the DOS commands MkDir (Make Directory) and Copy + Del + Move. For getting help on the command open a command box and enter the commands followed bei /? for help, e.g. like:

    C:\>MkDir /?

    Olaf Helper ----------- * cogito ergo sum * errare humanum est * quote erat demonstrandum * Wenn ich denke, ist das ein Fehler und das beweise ich täglich Blog
    • Proposed as answer by Naomi N Friday, February 18, 2011 7:58 PM
    • Marked as answer by Kalman Toth Friday, February 25, 2011 1:08 PM
    Friday, February 18, 2011 9:23 AM