How to set a timeout for a process under Windows 7?
start yourprogram.exe timeout /t 60 taskkill /im yourprogram.exe /f
start yourprogram.exe timeout /t 60 taskkill /im yourprogram.exe /f
Max is on he right track with the suggestion to use Windows Scripting for a way to do it without installing any additional executables on the machine. His code will work if you have the IIS SMTP service setup to forward outbound email using the “smart host” setting, or the machine also happens to be … Read more
I just tried it, and against my intuition, it picked up the new commands at the end (on Windows XP) I created a batch file containing echo Hello pause echo world I ran the file, and while it was paused, added echo Salute Saved it and pressed enter to contine the pause, all three prompts … Read more
You can call your .bat file using the External Tools feature (in the Run menu). Example:
The call command has this functionality built in. To quote the help for call: Substitution of batch parameters (%n) has been enhanced. You can now use the following optional syntax: %~1 – expands %1 removing any surrounding quotes (“) Here is a primitive example: @echo off setlocal set mystring=”this is some quoted text” echo mystring=%mystring% … Read more
In a batch file solution for /R c:\source %%f in (*.xml) do copy %%f x:\destination\ The code works as such; for each file for in directory c:\source and subdirectories /R that match pattern (\*.xml) put the file name in variable %%f, then for each file do copy file copy %%f to destination x:\\destination\\ Just tested … Read more
The executable binaries and .cmd files end up in C:\Users\<username>\AppData\Roaming\npm (minus the node_modules at the end) so adding that path to the PATH env. variable fixed the issue. With environment variables, the path can be abbreviated: %appdata\npm.
You have to save the batch file with OEM encoding. How to do this varies depending on your text editor. The encoding used in that case varies as well. For Western cultures it’s usually CP850. Batch files and encoding are really two things that don’t particularly like each other. You’ll notice that Unicode is also … Read more
You can use move for this. The documentation from help move states: Moves files and renames files and directories. To move one or more files: MOVE [/Y | /-Y] [drive:][path]filename1[,…] destination To rename a directory: MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2 [drive:][path]filename1 Specifies the location and name of the file or files you want to … Read more
There is a quite interesting way to execute script minimized by making him restart itself minimised. Here is the code to put in the beginning of your script: if not DEFINED IS_MINIMIZED set IS_MINIMIZED=1 && start “” /min “%~dpnx0” %* && exit … script logic here … exit How it works When the script is … Read more