Open another shell from cmd and execute commands from batch file - windows

I'm creating a batch file which will open windows command prompt and from there it will open another shell(windchill shell). There I have to execute a command which will do some operations.
#echo off
start cmd.exe /k "cd D:\PTC\Windchill\bin & windchill shell"
Above script is opening windchill shell but I couldn't find a way to execute commands on it. I do not have much experience in this. Looking for some help.
Thanks in advance

Related

Shell script execution in ssis

I have a file with extention .sh(shell script).
I need execute this file in ssis using execute process task.
how can i do this.
Please help me!!!
Code inside .sh file :echo SSIS test >> /home/junaib/test/sql.txt (for testing)
If you enabled WSL and you sure that the commands work from command line then you can run the command on cmd.exe with the /c flag
Executable : cmd.exe
Arguments : /c "BASH C:\SO\test.sh"

Continue With CMD Commands After Batch Script

I am trying to write a batch script which, once complete, would allow the user to continue using the Windows command prompt as they normally would had no script been run. Is this possible? Thank you in advance for any help.
If you manually open CMD (the Command Prompt) and invoke the batch file by name, CMD will remain open for additional commands after the batch file completes. You cannot do this by double-clicking on the batch file, but if you create a shortcut to the batch file that runs CMD.EXE with the /K switch, you will run the batch file and then leave CMD running for additional commands. See CMD at SS64.

How do I make a cmd script that once it is run, remains open and accepts new commands?

I want to make a cmd script that performs an action but then remains open and I can type new commands.
I have failed to find the proper terms to google as my knowledge of shell is almost zero.
thank you!
You can specify a command shell to run a specific command during start-up using the /k switch. E.g.
cmd /k C:\InitialScript.bat
The command shell would execute the C:\InitialScript.bat batch file and remain open for the user to type further commands.
If you want to create an icon for users to use then create a shortcut and use the following as the target:
%WINDIR%\System32\cmd.exe /K C:\InitialScript.bat
If you already have a command shell window open, then just use the following which will run the batch file in the context of the existing shell:
C:\InitialScript.bat

How to open a command prompt window in ruby script and have an interactive session

I have a requirement where i need to open command prompt and run a bat file, this bat file will ask for the user to enter a choice 2 to 3 times, how to automate this in ruby in windows.
Am able to open command prompt using
system("start cmd.exe")
After this I need to change directory and then i need to run the file present in c://temp//dat.bat, through ruby script.
Please let me know how to automate all these operations.
cmd_line = "cmd.exe /c \"cd #{directory}&&#{bat_file}\""
system(cmd_line) # if you're not interested in the output
Should do it.

Launch new command line and exucte in that shell

This must be a real dumb question. And I cant figure out how.
What I want to do is launch a new command line with some arguments and excute some commands there.
Here is what I have in my .cmd
CMD /k %EnvInstallPath% %wo% %var%
cd /d %wo%\src
When I execute test.cmd, I see that the directory changes to %wo%, but the further cd src is not executed. I need to cd to a directory and execute few other commands.
When you run cmd with /k the console runs the command and then resumes with the prompt. I'm guessing that what you want is to run the command and resume with the next one, so you need to run cmd with /c instead.
put the other commands in a different bat file and
start AFewOtherCommands.bat

Resources