I'm trying to script the shutdown of my VM Servers in a .bat.
if one of the vmware-cmd commands fails (as the machine is already shutdown say), I'd like it to continue instead of bombing out.
c:
cd "c:\Program Files\VMWare\VmWare Server"
vmware-cmd C:\VMImages\TCVMDEVSQL01\TCVMDEVSQL01.vmx suspend soft -q
vmware-cmd C:\VMImages\DevEnv\...
I have two code bases of an application. I need to copy all the files in all the directories with .java from the newer code base, to the older (so I can commit it to svn).
How can I write a batch files to do this?
...
I need to copy the newest file in a directory to a new location. So far I've found resources on the forfiles command, a date-related question here, and another related question. I'm just having a bit of trouble putting the pieces together! How do I copy the newest file in that directory to a new place?
...
Greetings,
I need a way (either via C# or in a .bat file) to get a list of all the computers on a given network. Normally, I use "net view", but this tends to work (from my understanding) only within your domain. I need the names (or at least the IP Addresses) of all computers available on my network.
Being able to get all compute...
for e.g from command prompt I need to launch the exe with some switch flags under debugger. How do I do it?
This is an exe from c/c++ and built using VS2005 environment that I need debug. I pass some flags to this exe to perform some stuff.
...
EDIT: This was formerly more explicitly titled: - "Best solution to stop Kontiki's KHOST.EXE from loading automatically at start-up on Windows XP?"
Essentially, whenever the 40D application is run it sets up khost.exe to automatically start-up with Windows. This is annoying as it increases my boot up time by a couple of minutes and I d...
I want to execute a certain batch file and redirect its console output to a text control in visual c++ or redirect the console output at the same time the logs/echo are showing.
...
How can I read the first line from a text file using a Windows batch file? Since the file is large I only want to deal with the first line.
...
I want to wrap a perl one-liner in a batch file. For (trivial) example, in a unix shell I could quote up a command like this:
perl -e 'print localtime() . "\n"'
But DOS chokes on that with the helpful
Can't find string terminator "'" anywhere before EOF at -e line 1.
What's the best way to do this within a .bat?
...
While normally it's good to always choose the right language for the job, it can sometimes be instructive to try and do something in a language which is wildly inappropriate.
It can help you understand the problem better. Maybe you don't have to solve it the way you thought you did.
It can help you understand the language better. May...
How can I script a bat or cmd to stop and start a service reliably with error checking (or let me know that it wasn't successful for whatever reason)?
...
I need to be able to load the entire contents of a text file and load it into a variable for further processing.
How can I do that?
Here's what I did thanks to Roman Odaisky's answer.
SetLocal EnableDelayedExpansion
set content=
for /F "delims=" %%i in (test.txt) do set content=!content! %%i
echo %content%
EndLocal
...
I have a problem with stopping a service and starting it again and want to be notified when the process runs and let me know what the result is.
Here's the scenario,
I have a text file output of an "sc" command. I want to send that file but not as an attachment. Also, I want to see the initial status quickly in the subject of the ema...
How could I iterate over each file in a directory using for? And how could I tell if a certain entry is a directory or if it's just a file?
...
If I am iterating over each file using :
@echo off
FOR %%f IN (*.*) DO (
echo %%f
)
how could I print the extension of each file? I tried assigning %%f to a temporary variable , and then using the code :
echo "%t:~-3%"
but with no success .
...
Is there any way to say if a file is a directory? I have the filename in a variable. In Perl I can do this:
if(-d $var) { print "it's a directory\n" }
...
I assist in maintaining an enterprise web-based system (programmed in J2EE, but this is a more general question) and I'd like to know: what good tools are out there to measure the "health" of an enterprise system? For instance, tools to check memory space on servers, check the status of batch runs, the number of records processed in a c...
How does one check if a directory is already present in the PATH environment variable? Here's a start. All I've managed to do with the code below, though, is echo the first directory in %PATH%. Since this is a FOR loop you'd think it would enumerate all the directories in %PATH%, but it only gets the first one.
Is there a better way of...
Has anyone had any recent requirements for programming automated DOS Batch style tasks on a Windows box?
I've got some automation to do and I'd rather not sit and write a pile of .BAT files in Notepad if there is a better way of automating these tasks: mainly moving of files under certain date and time conditions, as well as triggering ...
As I understand it, .bat is the old 16-bit naming convention, and .cmd is for 32-bit Windows, i.e., starting with NT. But I continue to see .bat files everywhere, and they seem to work exactly the same using either suffix. Assuming that my code will never need to run on anyhting older than NT, does it really matter which way I name my ba...