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

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

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?

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

Trigger a Batch Script inside a Batch Script

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

batch file stops after cvs checkout

I am just writing a small batch file that should checkout a module and build it using maven. But the batch file exits/stops after running the cvs checkout command. Below is the batch file contents.
call rmdir /S /Q C:\temp\project_folder
call cvs -q -d %CVSROOT% checkout -d C:\temp\project_folder module\workspace\project_folder
call cd C:\temp\project_folder
call mvn clean install
Any idea what I am doing wrong here?
The use of call is for generating a callback to the currently running batch file. If you were to call another batch file without the call command it will transfer control to the new batch file and will not record where it came from. With the call command it will remember what line of the batch file was executed and when the called batch file exits it will continue execution at the next line of the parent file.

Resources