# Batch file for Toad

**URL:** <https://forums.toadworld.com/t/batch-file-for-toad/46317>\
**Category:** Toad for Oracle & DevOps Toolkit\
**Created:** [April 22, 2019, 3:25pm UTC](https://forums.toadworld.com/t/batch-file-for-toad/46317 "2019-04-22T15:25:55Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![kiss.shoremishra](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@kiss.shoremishra](https://forums.toadworld.com/u/kiss.shoremishra)\
**Post date:** [April 22, 2019, 3:25pm UTC](https://forums.toadworld.com/t/batch-file-for-toad/46317/1 "2019-04-22T15:25:55Z")

</div>

Hi Team,  
I have updated my Toad for Oracle from Version 9.7.1 to 13.1.0.78 and now the batch file is not working.

I created a batch file to run a .sql file using older version of Toad(Version 9.7.1). We updated the toad to latest version (Version 13.1.0.78) but now the batch file is not able to execute the .sql file. I changed the URL so that it refer to new toad.exe file, batch file is able to open the sql file but unable to run it.

Below is the code

echo start cls

C:

cd C:\Program Files (x86)\Quest Software\Toad for Oracle 13.1\ %systemroot%\Syswow64\cmd.exe /K Toad.exe -c USER\_ID/Password@Database -f "C:\working\Automation\Batch\_Files\TPR\_Code\_SCDM\_Auto.sql" /exec

PROMPT TABLES UPDATED

GOTO:EOF EXIT /B

:END

---

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [April 22, 2019, 3:44pm UTC](https://forums.toadworld.com/t/batch-file-for-toad/46317/2 "2019-04-22T15:44:19Z")

</div>

-f just loads a file into the editor. Add /EXEC if you want it to execute automatically.

Edit:  
Oops! I see you have /exec in there already. Change it to uppercase and it should work.

Also, have a look at Toad's Automation Designer to learn about how to do more things from command line with Toad. It's in the help file, but you can also find out a lot about it by searching this forum.

---

<div class="post-metadata">

**Author:** ![kiss.shoremishra](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@kiss.shoremishra](https://forums.toadworld.com/u/kiss.shoremishra)\
**Post date:** [April 26, 2019, 12:43pm UTC](https://forums.toadworld.com/t/batch-file-for-toad/46317/3 "2019-04-26T12:43:03Z")

</div>

I did tried /EXEC but its not working. The issue is with only Toad for Oracle 13.1. Older version is working fine

---

<div class="post-metadata">

**Author:** ![kiss.shoremishra](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@kiss.shoremishra](https://forums.toadworld.com/u/kiss.shoremishra)\
**Post date:** [April 26, 2019, 12:50pm UTC](https://forums.toadworld.com/t/batch-file-for-toad/46317/4 "2019-04-26T12:50:53Z")

</div>

> [@JohnDorlon](#):
>
> -f just loads a file into the editor. Add /EXEC if you want it to execute automatically.

Could it be because I have 2 versions of Toad installed on my computer ?

---

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [April 26, 2019, 1:25pm UTC](https://forums.toadworld.com/t/batch-file-for-toad/46317/5 "2019-04-26T13:25:57Z")

</div>

I verified that /EXEC works in 13.1, but only if you write it in UPPERCASE. You have it in lowercase in your command above.

I fixed that for 13.2.

> Could it be because I have 2 versions of Toad installed on my computer ?

No, I have more than that.

---

<div class="post-metadata">

**Author:** ![kiss.shoremishra](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@kiss.shoremishra](https://forums.toadworld.com/u/kiss.shoremishra)\
**Post date:** [April 26, 2019, 1:33pm UTC](https://forums.toadworld.com/t/batch-file-for-toad/46317/6 "2019-04-26T13:33:36Z")

</div>

I tried /EXEC but its only starting the toad and loads file into editor. Not able to execute.

---

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [April 26, 2019, 1:49pm UTC](https://forums.toadworld.com/t/batch-file-for-toad/46317/7 "2019-04-26T13:49:44Z")

</div>

Oops, sorry, I must have tested with 13.2 before and not 13.1  
I can reproduce the problem even with uppercase in 13.1.  
In the meantime, if you don't mind running your command as script, then this works:

toad.exe -c user/pass@db -f "C:\YourScript.sql" /SCRIPT

If it needs to happen in the same session as main Toad connection, go to Options -\> Oracle -\> Transactions, then make sure "Execute scripts in Toad Session" is checked.

I'll look into 13.1 EXEC and see if I can find the problem there. WIll get back to you on that.

---

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [April 26, 2019, 2:23pm UTC](https://forums.toadworld.com/t/batch-file-for-toad/46317/8 "2019-04-26T14:23:02Z")

</div>

Well, it is definitely broken in 13.1, and I don't think there is anything you can do to make it work.

So your workarounds are:

1. Use /SCRIPT instead of /EXEC
2. Download the 13.2 beta and use that instead.

If you can use the beta, please do. The nice thing about that is if you find a problem, we can usually have a fix for you in a day or two. I'd really like to see a lot more beta users. It's good for you, and good for Toad.

You can get the beta here:

> [@Toad for Oracle 17.1 Beta](https://forums.toadworld.com/t/toad-for-oracle-13-2-beta/41283):
>
> We are pleased to announce the Toad for Oracle v17.1 beta We encourage you to participate in the beta program to help us deliver a high quality product. This is your opportunity to participate in the development, direction, and testing of Toad for Oracle. By becoming a beta tester you will have direct access to the development team and product management via the Toad World forum. Instructions for joining the Beta program: Read the [Beta Agreement](https://www.toadworld.com/quest-beta-agreement). Downloading the Toad Beta constitutes usage…

---

<div class="post-metadata">

**Author:** ![kiss.shoremishra](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@kiss.shoremishra](https://forums.toadworld.com/u/kiss.shoremishra)\
**Post date:** [April 26, 2019, 2:34pm UTC](https://forums.toadworld.com/t/batch-file-for-toad/46317/9 "2019-04-26T14:34:28Z")

</div>

> [@JohnDorlon](#):
>
> /SCRIPT

/SCRIPT works. Thank you so much. Thanks a lot.

---

<div class="post-metadata">

**Author:** ![kiss.shoremishra](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@kiss.shoremishra](https://forums.toadworld.com/u/kiss.shoremishra)\
**Post date:** [April 26, 2019, 3:06pm UTC](https://forums.toadworld.com/t/batch-file-for-toad/46317/10 "2019-04-26T15:06:40Z")

</div>

Now it is perfectly getting executed as script but after that , I am not able to exit toad.

None of the below code works

PROMPT TABLES UPDATED

GOTO:EOF  
EXIT /B

:END

I tried EXIT and EXIT /B but it does not work and when I close it manually, it again give prompts that ask Commit or Rollback.

Also could you suggest me some material, website to learn toad as a developer ???

---

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [April 26, 2019, 3:45pm UTC](https://forums.toadworld.com/t/batch-file-for-toad/46317/11 "2019-04-26T15:45:22Z")

</div>

> it again give prompts that ask Commit or Rollback.

Add a commit at the end of your script and I think the prompt will go away.

If your goal is to just run some SQL and then exit Toad, you really should use the automation designer. It will really simplify your batch file, and you won't need EXIT or EXIT /B anymore.

I made a video of how to set it up and how to run it. I forgot to show in the video that you need to have the "save passwords" option in the login screen turned on.

 ![ScriptAction](https://global.discourse-cdn.com/quest/original/2X/3/33cce20ea7682f5f0e4bc3d94943f584fdaf54ce.gif)

As for learing materials, here are a few quick suggestions:

1. Videos on Toadworld [https://blog.toadworld.com/tag/toad-for-oracle-videos](https://blog.toadworld.com/tag/toad-for-oracle-videos)
2. [https://support.quest.com/toad-for-oracle/training](https://support.quest.com/toad-for-oracle/training)
3. Videos on youtube [https://www.youtube.com/results?search\_query="toad+for+oracle](https://www.youtube.com/results?search_query=%22toad+for+oracle)

---

<div class="post-metadata">

**Author:** ![kiss.shoremishra](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@kiss.shoremishra](https://forums.toadworld.com/u/kiss.shoremishra)\
**Post date:** [April 29, 2019, 2:27pm UTC](https://forums.toadworld.com/t/batch-file-for-toad/46317/12 "2019-04-29T14:27:35Z")

</div>

> [@JohnDorlon](#):
>
> automation designer

Thank you so much for all the efforts. Appreciate it alot.

---

<div class="post-metadata">

**Author:** ![jondel2019](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jondel2019](https://forums.toadworld.com/u/jondel2019)\
**Post date:** [May 30, 2019, 9:22am UTC](https://forums.toadworld.com/t/batch-file-for-toad/46317/13 "2019-05-30T09:22:46Z")

</div>

Thanks for the solution... helped my code too
