Trigger a Batch Script inside a Batch Script - batch-file

I have to Trigger a Batch script inside a Batch script. First I should be able to open the new command prompt and then I should be able to execute the new batch file in it.
This is The batch code
C:\XXXX\AppScanSrcCli.exe;
Script C:\XXXX\XXXX\XXXX\appscansample.bat
The above code was placed in a .bat file

you just put
start "file.bat"
instead of just the file

Related

Batch file that launch commands in CMDER

I need to find a way to execute commands in bat file via cmder.
When I put start -cur_console:s1T50H -cur_console:d:C:\Users\MY\Path\ inside cmder its open another shell as i want.
What should I do to make it happen when I execute my bat file?
My .bat file right now:
#echo off
start C:\Users\PATH\TO\CMDER\FOLDER\cmder.exe
pause
What should I write after start the cmder?

.vbs script runs in batch file but not when run through task scheduler

I have a batch script with 4 commands as follows
sqlcmd (truncate table in database)
del "path to existing csv to delete"
"path to my .vbs script" "file path to xls file to convert" "file path to where csv is to be created"
"File path to Python" "File path to python script to read csv into database"
It runs just fine when I double click the batch file. When I try to run the batch file from the command prompt it doesn't see the .csv file to delete, I'm not sure why this is, but I don't think it matters for my purposes.
When I run the task from task scheduler manually it truncates the table in the database and deletes the existing csv file but the new one is not created which leads me to believe it is getting stuck on the .vbs file.
I have tried making an individual task with the .vbs script and passing in the path to the .xls and .csv files as arguments, but again it just runs without stopping.
I have tried adding
#echo off
>log.txt(
the body of my batch script
)
but nothing gets written to the log. I have also tried adding cscript and also tried adding wscript at the beginning of the line in the batch file which calls the .vbs script and have tried changing the start in directory to C:\batch where the file resides.
No luck with any of the above attempts. Not sure where to go from here.
Found this 2013 answer by eric on Superuser:
Create these two folders:
32Bit:
C:\Windows\System32\config\systemprofile\Desktop
64Bit:
C:\Windows\SysWOW64\config\systemprofile\Desktop
Excel needs these folders if it's not run interactively. Create both folders even if you are on a 64-bit OS.

Executing WinSCP command in batch file

I am new to batch and trying to execute a script I wrote, essentially I want to go to a remote server copy the files there and transfer it to a folder in my local directory. I am executing the bactch file but nothing is being copied any suggestions would be great. This is my script
open sftp://site:#ftp.site.net -hostkey="server finger print"
synchronize local C:\Users\localdirectory\Desktop\test2 /Home/folderA/NewFiles
exit
I am positive all the information is correct because that's how I login with WinSCP. I got this script from https://www.youtube.com/watch?v=ndvEYOQLc4c
This is WinSCP script. There's no batch file in your question.
To run WinSCP script, use for example:
"C:\Program Files (x86)\WinSCP\WinSCP.com" /script="C:\path\to\winscp.txt"
(assuming your WinSCP script is in C:\path\to\winscp.txt).
You can put the above command to a batch file.
See guide to scripting with WinSCP.
You can also have WinSCP GUI generate both the script and batch file for you (or even a batch file that directly contains the WinSCP commands).

Starting a batch file from another batch file only opens CMD

When I start a batch file from another batch file, it just opens a new CMD window named just "TEST.bat", and doesn't run the actual batch. Running it manually works fine.
cd %~dp0\Colours\TEST.bat
start "TEST.bat"
I have tried many different ways to run the batch, but it all does the same thing. I've also tried to run the batch as administrator but same result again.
Full code(not finished): http://pastebin.com/GE8yJP0J
To run another batch file, use call not start. Also: cd expects a directory, not a filename.
cd "%~dp0\Colours"
call TEST.bat

How to run commands on a batch file from command prompt?

I was working around creating an batch file to run commands on another batch file. for example: we want to run md C:\abc from a batch file. how can I do this?
thanks
You need to call the other batch file within a batch file:
call other_batch_file.bat

Resources