Is there any way I can open a new cmd window from dosbox?
Cannot use start directly/indirectly.
Mounting c: drive and directly typing the path doesn't work too..
Neither run nor execute commands work.
There is no limitation is that cmd should be opened in new window, etc. Actually i am doing this to enter 2-3 string inputs. (where choice command is not applicable)
Thanks in advance.
Although DOS is a monotask system, multiple instances of DOSbox can coexist on the hosting OS, and they can communicate by shared files with one another.
I tried the following batch STARTDOS.CMD on my Windows10 system (it can run either in CMD window or as a service):
#ECHO OFF
TITLE %0
ECHO >C:\STARTDOS.REQ
:LOOP
SLEEP 3
IF NOT EXIST C:\STARTDOS.REQ GOTO :LOOP
DEL C:\STARTDOS.REQ
ECHO Starting another DOSbox ...
START D:\APL\EMU\DOSBox\DOSBox.exe -userconf -noconsole
GOTO :LOOP
This batch checks the existence of semaphore file C:\STARTDOS.REQ to start another DOSbox instance in a new cmd window.
In DOSbox configuration file I have mount c C:\
Now if I execute ECHO >C:\STARTDOS.REQ withing one DOSbox window, this will launch another DOSbox in its own cmd window.
Related
I am running a .bat file on my windows pc.
what I am trying to do is have several commands run when .bat file opens.
I also want enable the cmd prompt window to stay open when the .bat file is run.
In order to keep the .bat open when I used cmd /k at the start of my .bat file.
this seem to enable the window to stay open. Then I want to run my commands, however, the first command is the only one that seems to run. my set up is as follows:
cmd /k
echo a
echo b
echo c
the cmd prints a no problem but does not print the others.
i have tried adding & and && to no avail.
I am creating my .bat from a .txt file and saving it with the .bat extension.
any ideas how i can get the remaining echo b and echo c commands to run?
Why not just change the order?
#Echo a
#Echo b
#Echo c
#%SystemRoot%\System32\cmd.exe /D /K
…which in your less robust syntax, would look like this:
echo a
echo b
echo c
cmd /k
I've recently installed cmder (or simply 'Commander') portable console emulator for windows, and really like the functionalities it comes with. But how can you (if at all) run batches through it like you can with the Windows command line?
The details:
If you write...
cd C:\test\
REM executeSomething.exe
Pause
... to a textfile and save it as a .bat file you can do can do pretty much anything just by double-clicking that file. I've got a work-flow where I launch a web-application through a batch file. Sometimes this applicaton launches automatically in Chrome, and sometimes it does not. In that case, I'll have to copy and paste a URL to Chrome manually. And that's a real pain. With cmder.exe that's much easier, but I'll have to manually navigate to a folder and start the application through Commander it manually without the luxury of a .bat file.
The functionality I'm trying to run automatically with cmder.exe is simply changing a folder and starting an executable file, specifically Jupyter Lab:
cd C:\jupyterlab\
jupyter lab
Pause
I've tried various approaches with:
#echo off
set CMDER_ROOT=C:\Cmder
start %CMDER_ROOT%\vendor\conemu-maximus5\ConEmu.exe /icon "%CMDER_ROOT%\cmder.exe" /title "Homestead VM" /loadcfgfile "%CMDER_ROOT%\config\ConEmu.xml" /cmd cmd /k "%CMDER_ROOT%\vendor\init.bat cd %CD% && %~1"
as described here, but with no success. The example above does launch commander, but also raises a syntax error:
Current directory: C:\batches
Command to be executed: "C:\Windows\system32\cmd.exe" /k
"C:\Cmder\vendor\init.bat cd C:\batches && "
I'm obviously on to somehting here since I'm able to start Commander, but I'm not sure how to edit the remaining code to run the necessary steps. I do realize that the /title "Homestead VM" part just edits the title of the Commander window:
but I have no idea about the rest.
If this just isn't possible, I'm going to have to try to reassociate .bat files in Control Panel > Default Programs > Associate a filetype, but I'm hoping to avoid that.
Thank you for any suggestions!
System info:
Windows 7, 64 bit
Commander v1.3.12
Edit 1: My (failed) attempt trying to follow a suggestion from Gerhard Barnard
I've saved a file named please.cmd to C:\Windows\System32 that contains this:
#echo off
if not defined CMDER_ROOT set "CMDER_ROOT=C:\Cmder"
start %CMDER_ROOT%\vendor\conemu-maximus5\ConEmu.exe /icon "%CMDER_ROOT%\cmder.exe" /title "Homestead VM" /loadcfgfile "%CMDER_ROOT%\config\ConEmu.xml" /cmd cmd /k "%CMDER_ROOT%\vendor\init.bat cd %CD% && %~1"
I've also saved a file named SObatch.bat in C:\batches that contains this:
if not defined myComs set myComs=0 && please %~0
#echo off
ping localhost
echo %userprofile%
pause
Upon double-clicking SObatch.bat a Windows prompt is opened, and the pings are run:
I just narrowed the window to leave out real-world user-names. But the ping functions are being run and the usual responses are returned.
So I guess it still seems that I've broken something.
Create a file called please.cmd and save it to C:\Windows\System32 as administrator. It should then exist as c:\Windows\System32\please.cmd
#echo off
if not defined CMDER_ROOT set "CMDER_ROOT=C:\Cmder"
start %CMDER_ROOT%\vendor\conemu-maximus5\ConEmu.exe /icon "%CMDER_ROOT%\cmder.exe" /title "Homestead VM" /loadcfgfile "%CMDER_ROOT%\config\ConEmu.xml" /cmd cmd /k "%CMDER_ROOT%\vendor\init.bat cd %CD% && %*"
Now when you create a batch files you need to make some changes in the top of each batch file you want. You would need to add the below line to the very top of the script.
"%systemroot%\system32\please.cmd" "%~f0" && goto :eof
You can also from cmd please command to launch it from the cmder shell. Example:
please ping localhost
I have a VBscript that runs a bunch of programs, one of them being a batch file. In the batch file i use:
Mode 50,8
This makes the window the right size and makes it look nice. However, in the cases where i open the batch file using the VBscript i want it to be minimized, that is done like this:
objShell.Run("path_of_my_batch_file"),7
The problem is that this makes the batch file completely ignore the instructions to stay at "Mode 50,8" and open the batch file in the default CMD size.
So my question is: How can i open my batch file in minimized mode using my VBS-file, but also let it keep the size?
Putting this at the top of the batch file workes:
Pause
Mode 50,8
But that means i have to press a key before it gets the right size and i defenetly dont want that. I need a way to either run the "Mode 50,8" command as soon as the batch file is no longer minimized or a way to let it keep the size after the VBS-file minimizes it.
The problem is that the mode 50,8 command desn't seem to have an effect while in minimized state.
There are
workarounds
with .appac tivate and then using sendkeys but
I'd prefer the 3rd party app NirCMD which enables the batch to minize/restore
itself.
' Q:\Test\2018\07\23\SO_51469493.vbs
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("Q:\Test\2018\07\23\SO_51469493.cmd")
:: Q:\Test\2018\07\23\SO_51469493.cmd
#Echo off
Title Min5x80
Mode 80,5
Echo now minimizing using:
Echo nircmd win min title Min5x80
Timeout /t 5 & nircmd win min title Min5x80
Timeout /t 5 & nircmd win normal title Min5x80
cls
Echo back again
Pause
This will involve a flicker when running the batch.
I have a bat file that I would like to open another bat file minimized from the desktop. I tried doing this:
#echo off
start /min "%USERPROFILE%\Desktop\coolkids.bat"
exit
But it just opened up a blank command prompt, even though "coolkids.bat" has commands in it.
I have a windows 10 PC
The first quoted argument of start is taken to be the caption of the new window. Try the following instead, and check start /? for the full syntax.
start /min "" "%USERPROFILE%\Desktop\coolkids.bat"
I have 2 .bat files test1.bat and test2.bat and I get a window opening flash for a brief period that I do not want to happen.
test 1.bat is called by double clicking on an associated file extension .zgb
test1.bat =
#echo off
START /MIN c:\test\test2.bat %1
exit
test2.bat =
#echo off
"c:\test\test.accdb" /cmd %1
exit
Why I use 2 .bat files is that if I call test2.bat directly I get a command window open the entire time until the Access program closes.
But the problem is that I still get a (less than a second) flash before the Access program is run. I assume the flash is a command window being opened than minimized.
Is there any way to not have any visual indication of anything before the Access program opens?