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
Related
Very often I have to make following steps in command line (to identify correct worker process in IIS for debugging):
Run cmd as an administrator
cd %systemroot%\system32\inetsrv
appcmd list wp
I want to make a shortcut on the desktop to do it in one click.
How can I achieve that?
P.S. I tried to specify it like on the picture but it doesn't work, just opens cmd in inetsrv folder
I assume you set up the shortcut to run as admin, so I do not go into details on that.
What is missing in your Target line is the switch to tell cmd.exe that there are strings following which should be interpreted and executed as command. You can chose /C for execute and quit (cmd window disappears) or /K for execute and show prompt (cmd window stays open). So the result would be something like: "%windir%\system32\cmd.exe" /K "appcmd list wp". See cmd.exe /? for details.
GL, HF :)
::Checks if there is a JRE installed
start "%USERPROFILE%\Downloads\ConfCompiler\Tools\CheckJre.exe"
When I copy and paste the file location above into Windows Explorer it works fine. But the program does not run from the batch file I have created.
The purpose of CheckJre.exe is to create new keys inside of HKEY_CURRENT_USER.
The keys are created when I simply run it from Windows Explorer. But the keys are NOT created when running it from the batch file. The batch file just results in displaying a command prompt window with showing CheckJre.exe with full path in title bar.
Does anyone have a hint why?
Command start interprets the first double quoted string as title for the command line window to open. For all options of command start enter in a command prompt window either start /? or help start.
You need to explicitly specify a title in your batch file because of the double quoted string to run CheckJre.exe.
Use in batch file:
start "Check JRE" "%USERPROFILE%\Downloads\ConfCompiler\Tools\CheckJre.exe"
I have a windows 8.1 machine and I want to open a program with minimized window.
For a program like notepad, I just use the following command:
start /min "" "C:\Windows\notepad.exe"
and then a new notepad window starts in minimized mode.
The problem is that not all programs do this. When I want to start for instance MS Word in minimized mode I use:
start /min "" "C:\Program Files (x86)\Microsoft Office\Office12\WINWORD.EXE"
but then a new Word windows starts up in MAXIMIZED mode.
Is there a way to start it minimized?
I tried this commands in my PC.It is working fine....
To open notepad in minimized mode:
start /min "" "C:\Windows\notepad.exe"
To open MS word in minimized mode:
start /min "" "C:\Program Files\Microsoft Office\Office14\WINWORD.EXE"
Try this
Go to the properties of the shortcut that points to the program (ALT ENTER or right click->properties); if there is no shortcut to it, you can make it by dragging and dropping the program while holding CTRL SHIFT;
Click in the Normal window dropdown, and choose minimized;
Save and run the shortcut.
You could try using the third-party tool called NirCmd. It is a genuine, free command line utility. If or when you have it, use this code in a batch file:
title Open Word
nircmd win hide title "Open Word"
start "C:\Program" "Files" "(x86)\Microsoft" "Office\Office12\WINWORD.exe
nircmd wait 20
nircmd win min foreground
exit
This program, in order, changes its title, hides itself according to its title, starts Word, waits 20 milliseconds as a buffer for Word to settle, minimizes Word by assuming it is now the top window, and then exits itself. This program should work as intended as long as their are no key presses or clicks in that ~50 millisecond time window, which shouldn't be hard.
As for installing nircmd on your computer, use this link, and click "Download NirCmd" at the bottom of the page. Save the .zip folder to a normal directory (like "My Documents"), extract it, and copy "nircmd.exe" to %systemroot%\system32, and there you go. Now you have nircmd included with your command line utilities.
Try:
start "" "C:\Program Files (x86)\Microsoft Office\Office12\WINWORD.EXE" --new-window/min
I had the same problem, but I was trying to open chrome.exe maximized. If I put the /min anywhere else in the command line, like before or after the empty title, it was ignored.
Local Windows 10 ActiveMQ server :
#echo off
start /min "" "C:\Install\apache-activemq\5.15.10\bin\win64\activemq.bat" start
Its actually not so simple.
It depends what you're trying to do and how the program behaves/interacts with Windows and UAC.
Certain programs will not start from a shortcut (for whatever reason that Windows determines). I have such a case with ViceVersa. I wanted to run the scheduler (VVScheduler) and no way could I get it to run via a shortcut in the user startup folder"s". Even with UAC disabled. Just would not start. Even tried adding it direct to the registry, no luck. So I was confined to using a batch file to run it at startup.
In my case I was unable to get it to open minimized, I tired the various syntax options offered in this post, none worked for me. I've resorted to just clicking the "-" on the VVScheduler window after startup.
For the people which are looking for the opposite (aka fullscreen), it's very simple. Because you just have to replace the settings /min by /max.
Now the program will be open at the "maximized" size !
In the case, perhaps you will need an example : start /max explorer.exe.
The answer is simple. Just look at the image.
I am using Windows 7
How can i run an input file (text file of commands) in an exe progam in CMD please.
Using other questions on the site, i have tried:
CMD /c ""C:/Program Files/Mplus/Mpluswin.exe" "C:/Users/jj/Desktop/mplus/test_mplus.inp""
which opens the input file in the program but does not run it
and this, which opens the program, but not the script
CMD /c "C:/Program Files/Mplus/Mpluswin.exe" < "C:/Users/jj/Desktop/mplus/test_mplus.inp"
Does this depend on the exe program?
Edit:
At present, the first command above launches the exe program and opens the text file within it (this is a file of program specific commands that will read in data, run calculations and output automatically). I can then run the commands in the exe program that has been opened (by selecting run in a menu) . But, I would like to pass the file to the exe program and it to be run automatically, ideally in the background. I am not sure of the correct terminology to use, so sorry if my description is unclear.
I've just noticed that you enclosed the entire term in an extra set of double quotes, and used linux forward slashes - try this batch file and also see if there is any error message on the console.
#echo off
cd /d "%userprofile%\Desktop\mplus"
"C:\Program Files\Mplus\Mpluswin.exe" "test_mplus.inp"
echo mplus was launched
pause
[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