One of my API calls can result in updates to a large number of objects (Django models). I'm running into performance issues with this since I'm updating each item individually, saving, and moving on to the next:
for item in Something.objects.filter(x='y'):
item.a="something"
item.save()
Sometimes my filter criterion looks like...
I have a file with n lines. (n above 100 millions)
I want to output a file with only 1 of 10 lines, I can't split the file in ten part and keep only one part, as it must be a little more random. later I have to do a statistical analysis I can't afford to create a strong bias in the data).
I was thinking of reading the file and for each...
I have a nightly batch job that can tell if it has failed. I want it to send me an email, possibly with an attachment when it does.
How can I send an email from a Windows Batch (.bat) file?
...
Here's a minimal batch file, demo.bat, to illustrate my problem:
@ECHO off
set /p foo=Enter foo:
echo.
echo you typed "%foo%"
sqlcmd -?
set /p bar=Enter bar:
echo.
echo you typed "%bar%"
I have an input file foo.txt that looks like so:
foo_value
bar_value
I run my batch file as demo.bat < foo.txt. The output is:
Enter foo:
y...
Inside a windows batch file I'd like to figgure out what the fully qualified path name of this batch file is.
I tried %0 but this does only give me the typed command (e.g. just the file name without path or extension).
...
I am writing a batch script which I wish to open a file and then change the second line of it. I want to find the string "cat" and replace it with a value that I have SET i.e. %var% . I only want this to happen on the second line (or for the first 3 times). How would you go about doing this?
...
I am writing a batch file, in which I call an EXE to execute. Now, statements after the call to the EXE should not execute till the EXE completes its execution. How can I do it in the batch file (on Windows)?
...
I would like to be able to query whether or not a service is running from a windows batch file. I know I can use:
sc query "ServiceName"
but, this dumps out some text. What I really want is for it to set the errorlevel environment variable so that I can take action on that.
Do you know a simple way I can do this?
UPDATE
Thank...
I'd like to find Windows batch counterpart to Bash's "$@" that holds a list of all arguments passed into script.
Or I have to bother with "shift"?
...
Hi,
for testing purposes i need an recursive directory with some files, that comes to maximum path-length.
The Script used for the creation consists only of two for-loops, as followed:
for /L %%a in (1 1 255) do @(
mkdir %%a
&& cd %%a
&& for /L %%b in (1 1 %random%) do @(
echo %%b >> %%a.txt
)
)
Now I would li...
Hello
First of all, sorry for my poor english. I would try to explain my problem.
I am using psexec within a script to restart a cluster as follows:
script1 in node1: perform a lot of tasks (shutdown services, check status, etc..) in the node1 and after completing all task launch with psexec the script2 in node2 (psexec-d \ \ node2...
Hello.
I'm using Windows XP Service Pack 3 and have Command Extensions enabled by default in the Windows Registry.
Somehow, the following command does not work on this version of Windows but if I run it in Windows Server 2003 or Windows Vista Business, it works just fine. Any clue?
The problem is that on Windows XP, it seems like the /...
Hello,
I am tring to open several instance of IE with the start command in a batch file. For example I want to open www.google.com and www.yahoo.com at the same time in separate windows.
Any help would be appreciated.
Regards,
Aaron
...
Hi there,
I would like to show the user with a spinner, that something is done in background but do not know how this works in a batchfile.
Does anyone have a clue?
...
I have a whole bunch of POV-ray files from a molecular dynamics simulation with the general name "frameXX.pov" where "XX" is the number of the frame. I want to render them all but I have like 500 so I really don't wanna do it by hand. I'm sure there is a way to do this from the command line or a batch file...what would be the best way ...
I am working on some batch file.
I need to read name from some text file. Let me explain it
I have one file File.txt, which has entry like ”FirstName=John”.
Now my batch file should read text ”John” from the file and I should be able store ”John” in some variable too.
But with following code, If I use “delims==”,I can get ”FirstName” t...
I'm working with an application that logs to Windows Application Log regularly (viewable through the Event Viewer administrative tool), and I'm looking for a way to back it up on a daily basis. This is important because we sometimes discover a problem with the application - and to investigate further we need information that was logged a...
Assuming Windows, is there a way I can detect from within a batch file if it was launched from an open command prompt or by double-clicking? I'd like to add a pause to the end of the batch process if and only if it was double clicked, so that the window doesn't just disappear along with any useful output it may have produced.
Any cleve...
I'm going to propose to a client that I build some batch jobs in Java that will run on their mainframe and/or AS/400s (sorry System z and System i). Both platforms are up to date system software wise. I'm wondering if anyone has done this and can provide any pointer or gotchas to watch out for.
The motivation is to have access to the to...
Further to How to Pass Command Line Parameters in batch file how does one get the rest of the parameters with specifying them exactly? I don't want to use SHIFT because I don't know how many parameters there might be and would like to avoid counting them, if I can.
For example, given this batch file:
@echo off
set par1=%1
set par2=%2
s...