I am trying to run the .exe of a programm I donwloaded. But to see why it isn`t working I want to keep the cmd open to see the output it generates. Is that somehow possible?
Use the /K switch: cmd /K "my.exe".
Related
For my work I have to run a string in "run".
I want to make this in a bat file but the arguments are not used but without them the program will not run.
This is the string:
"C:\Program files (x86)\MicroTouch\MT7\TwUI.exe" TwUICP.dll CPMain
Can someone help me with this problem?
You can simply put the same line of code into your bat file:
"C:\Program files (x86)\MicroTouch\MT7\TwUI.exe" TwUICP.dll CPMain
There are some options you can use. For example if you want the program to run hidden in background you can add start /b before the line. start /w will make the cmd window stay open and wait for your program to finish. You can even definde which CPU cores the program should use. For more information open the console and type start /? or check out http://ss64.com/nt/start.html.
Have the same problem, same software i think...
"C:\Program Files (x86)\MicroTouch\MT 7\TwUI.exe" twuicp.dll CPMain
Running that line through task manager -> new task will open a tool to configure touch-screen options, calibrate, etc...
Well same line doesnt work in a bat or cmd file. If i try to launch this tool through cmd.exe it doesnt work either.
The answer is always the same:
USAGE: twui <DLL name> <UI symbol name>
This works, but same line in cmd.exe dont
[Context: I'm trying to create a shortcut to a .bat file with a relative "Start in" path as roughly described here and here.]
cmd.exe supports the /c switch. According to the documentation, this should cause it to "carry out the command and then terminate."
But the switch seems to be ignored when the command is a .bat file.
For example, if you create a shortcut with the following Target (to a normal, non-bat command):
C:\Windows\System32\cmd.exe /c "START /d C:\temp\ notepad.exe test.txt"
Everything works as expected: Notepad opens and the console (shell) disappears. But if you replace the command above with a .bat file instead, like so:
C:\Windows\System32\cmd.exe /c "START /d C:\temp\ C:\test.bat"
(where test.bat contains only "notepad.exe test.txt") Notepad opens as before but the console sticks around like an unwanted friend. Why? And more to the point, How do I make it go away?
UPDATE: I know I can use wscript, as in this solution, but then I lose the option of having a custom icon (I'm stuck with the default .vbs icon).
The start command begins a new process for the batch file. The original cmd.exe then terminates, but leaves the new process, which hangs around because it's waiting for notepad.exe to terminate.
Change your bat file contents to:
start "" notepad.exe test.txt
Then your batch file will not wait for notepad to exit before continuing execution.
Another thing to try:
C:\Windows\System32\cmd.exe /c "START /d C:\temp\ C:\test.bat & exit"
The nuclear option would be to write a small program in the (compiled) language of your choice that launches the .bat file and then exits. Then you can give it a custom icon, and make it do whatever you like.
You might also take a look at Autoit from http://autoitscript.com as an alternative to batch. - the Run() command can do this kind of thing with better predictability. Since it makes an executable you can link this from a shortcut directly. You can also do a whole lot more of course, like run as a different user, insert delays or handle errors, that are hard to do with batch.
You don't need the full kit, just the Aut2EXE folder from the download will do.
BTW, build your exes without UPX compression as that leads to AV false positives.
I'm a little late but here is the answer.
The documentation for start states:
Syntax
START "title" [/D path] [options] "command" [parameters]
If command is an internal cmd command or a batch file then the command
processor is run with the /K switch to cmd.exe. This means that the
window will remain after the command has been run.
If start is used to execute a batch file, the opened cmd instance wont close.
You could also use call instead.
call C:\test.bat
Yes, I tried googling this, by the way.
Basically, what is the dos command that will open a dos command window?
In other words, if you have a .bat file full of script commands, what command can you do that will open a command window?
You can try this maybe. In the command line it starts it so I assume in a bat file it'll do the same.
start cmd
If you want it to run another bat or something you can do:
start script.bat
If you want it to close then:
start cmd /c script.bat
How can I run a command that is located in a folder using a text file. Here is the command
C:\Program Files\GAPS\XML Forms\CSurvey\temp>makecab/f directories.txt
currently I am able to run upto this path "C:\Program Files\GAPS\XML Forms\CSurvey\temp" using notepad by using the following as a notepad content
cmd /k "cd C:\Program Files\GAPS\XML Forms\CSurvey\temp"
But i'm not able to run the makecab/f directories.txt from notepad. how to modify the notepad content so that the makecab/f directories.txt will execute automatically without manually typing the command in run window?
I assume you want to be able to run the above command using a text file?
That does not make much sense, but maybe due to your English level, I can try to answer your question
Open a new notepad text file.
Type the command you want to run:
C:\Program Files\GAPS\XML Forms\CSurvey\temp>makecab/f "C:\Program Files\GAPS\XML Forms\CSurvey\temp\directories.txt"
Notice that you need to specify full path for directories.txt because since you will run this command from somewhere else, you would need to make sure the path is correct.
Save the file as SomeFileName.bat notice that you must save it with .bat not .txt otherwise, the file will not be executable. Also, make sure Windows is not hiding known extensions to avoid having your file named: YourFileName.bat.txt.
There are two ways of solving your problem.
If you want the command window to remain open after finishing the job, then change this line:
cmd /k "cd C:\Program Files\GAPS\XML Forms\CSurvey\temp"
to this one:
cmd /k "cd C:\Program Files\GAPS\XML Forms\CSurvey\temp & makecab/f directories.txt"
Alternatively, though, you could have the command window close automatically upon completing the batch script. In that case replace your command with these two lines:
cd C:\Program Files\GAPS\XML Forms\CSurvey\temp
makecab/f directories.txt
Note the absence of cmd /k. The command window will automatically open when you start the script and it will stay open while the script is executing.
I have a program that changes my desktop wallpaper by dragging the picture file onto it. I also have a wireless network program that can auto open programs everytime it connects to a certain network.
I want to change my desktop everytime it connects to a certain network, but running the wallpaper program doesn't do anything unless I drag the picture onto it. However, I can also run a cmd prompt "c:/program.exe picture.jpg"
I tried creating a batch file START C:/PROGRAM.EXE PICTURE.JPG, but it doesn't work.
So basically I am trying to create a program that can run the cmd prompt "c:/program.exe picture.jpg" - can you help, please?
Remove the "start" from the batch file, and make sure any paths with spaces in them are enclosed in quotes, otherwise they'll be broken into arguments.
For example:
"C:\Program Files\MyProgram.exe" "C:\Documents and Settings\Me\MyPicture.jpg"
A batch job should work. Try skipping that START from your example.
Start - Run - Type :
cmd /c "start /max ""C:\Program Files\MyProgram.exe"" ""C:\Documents and Settings\Me\MyPicture.jpg""" .
The cmd /c - starts a new cmd instance and quits