Note that there are some explanatory texts on larger screens.

plurals
  1. POcreate batch file from batch or how do i write non executed code
    text
    copied!<p>I'd like to create a batch file from another batch. So how do i write code inside a new bat, without executing it inside the original? My code so far is:</p> <pre><code>SET var1=%~dp0 SET var2 for %%a in ("%cd%") do set var2=%%~na echo bla %var1% bla &gt;&gt; build%var2%.bat </code></pre> <p>Instead of the "bla" there should be multiple lines of code. How do I archive this?</p> <p>Edit:</p> <p>now my code looks like this:</p> <pre><code>SET var1=%~dp0 SET var2 for %%a in ("%cd%") do set var2=%%~na SET string = ( echo SET mdbname=%var2% echo SET OfficeDIR=%%ProgramFiles(x86)%%\Microsoft Office\Office14 echo SET WorkDIR=%var1% echo md build echo copy %%mdbname%%.mdb build\%%mdbname%%.mda /Y echo "%%officedir%%\msaccess.exe" /compact "%%WorkDir%%\build\%%mdbname%%.mda" echo "D:****.exe" "%%WorkDir%%\build\%%mdbname%%.mda" "D:\****** Key - Nicht weitergeben" "%%officedir%%" echo copy "%%WorkDir%%\build\%%mdbname%%.mda" "%%ProgramFiles(x86)%%\*******" /Y ) echo %string% &gt;&gt; built%var2%.bat </code></pre> <p>But inside the new created batch there is only written: "ECHO ist eingeschaltet (ON)." / "ECHO is activated (ON)."</p> <p>Edit2:</p> <p>now it looks this, and there happens nothing, not even a file is created</p> <pre><code>SET var1=%~dp0 SET var2 for %%a in ("%cd%") do set var2=%%~na (echo SET mdbname=%var2% echo SET OfficeDIR=%%ProgramFiles(x86)%%\Microsoft Office\Office14 echo SET WorkDIR=%var1% echo md build echo copy %%mdbname%%.mdb build\%%mdbname%%.mda /Y echo "%%officedir%%\msaccess.exe" /compact "%%WorkDir%%\build\%%mdbname%%.mda" echo "D:\TFS\RepV\RepV 6.1\ITPBuildTool61.exe" "%%WorkDir%%\build\%%mdbname%%.mda" "D:\TFS\RepV\RepV 6.1\ITPEAK.OLKey Private Key - Nicht weitergeben" "%%officedir%%" echo copy "%%WorkDir%%\build\%%mdbname%%.mda" "%%ProgramFiles(x86)%%\Sage\Office Line\6.1\Addin\Work" /Y) &gt; built%var2%.bat </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload