windows

Putting a value on the load of a windows system

I've written an image processing script in php which is run as a cron scheduled task (in OSX). To avoid overloading the system, the script checks the system load (using 'uptime') and only runs when load is below a predefined threshold. I've now ported this over to Windows (2003 Server) and am looking for a similar command line function ...

How does Windows determine/handle the DOS short name of any given file?

I have a folder with these files: alongfilename1.txt <--- created first alongfilename3.txt <--- created second When I run DIR /x in command prompt, I see these short names assigned: ALONGF~1.TXT alongfilename1.txt ALONGF~2.TXT alongfilename3.txt Now, if I add another file: alongfilename1.txt alongfilename2.txt <--- created third ...

Windows temporary files behaviour - are they deleted by the system?

Using the .net framework you have the option to create temporary files with Path.GetTempFileName(); The MSDN doesn't tell us what happens to temporary files. I remember reading somewhere that they are deleted by the OS when it gets a restart. Is this true? If the files aren't deleted by the OS, why are they called temporary? They are...

batch file to delete files older than a specified date

How do I create a batch file to delete files older than a specified date? This does not seem to work; :: --------DELOLD.BAT---------- @echo off SET OLDERTHAN=%1 IF NOT DEFINED OLDERTHAN GOTO SYNTAX for /f "tokens=2" %%i in ('date /t') do set thedate=%%i type %1 pause set mm=%thedate:~0,2% set dd=%thedate:~3,2% set yyyy=%thedate:~6,4% ...

How can I run a program from a batch file without having the console open after the program start?

For the moment my batch file look like this: myprogram.exe param1 The program start but the Dos Windows still open... how can I close it? ...

Safe stream update of file

We perform updates of large text files by writing new records to a temp file, then replacing the old file with the temp file. A heavily abbreviated version: var tpath = Path.GetTempFileName(); try { using (var sf = new StreamReader(sourcepath)) using (var tf = new StreamWriter(tpath)) { string line; while ((l...

eof detection for DirectShow

Is there a way to detect that a DirectShow filtergraph has reached the end of its file? By end of its file, I mean that a filtergraph with a SampleGrabber filter will never receive another SampleCB call. Here are some things that don't work: Trust IMediaDet::get_StreamLength (it's often says there are more frames in a video than real...

Accessing network shares

Hi, I am currently trying to access a network share from my machine programaticaly using vc++ 6.0. I am using WNetAddConnection2 to connect to a share using my credentials. I am facing the following problem: Consider the case when there are 2 users trying to access the same remote share from same machine one after the other. Now once ...

What's the easiest way to change the Windows proxy address using .NET code?

I found a code samples here: http://sturla.simnet.is/post/2008/09/22/Enable-proxy-in-IE.aspx But it's very complex and involves manipulating the Windows registry. Is there an easier and less error-prone way of changing the proxy server address? ...

Working with the task scheduler 1.0 COM API

Hello, I'm trying to write a simple program in VC++ which will just initialize the task scheduler. I'm following the example suggested at the MSDN site, but I get unresolved symbol errors from the linker. The error is on this line: hr = CoCreateInstance(CLSID_CTaskScheduler, NULL, ...

How to make each Treeview Node have a related TextBox

Hi, I am trying to make a form in which the user fills in values. It is quite long. I wish to use an expandable tree to fit it into my one form. Is there any way to give each TreeView Node a TextBox by its side? Having the node text edited by itself is not enough. ...

How to use setspn to enable two java command line processes to authenticate windows process execution identity

Assuming I have a client and a server java process running on the commandline. I want the identity of each to come from the windows process it is executing under (in order to associate permissions in AD groups). Assuming I have a working knowledge of setspn http://technet.microsoft.com/en-us/library/cc773257(WS.10).aspx How do I get th...

Getting actual file name (with proper casing) on Windows with .NET

I want to do exactly the same as in this question: Windows file system is case insensitive. How, given a file/folder name (e.g. "somefile"), I get the actual name of that file/folder (e.g. it should return "SomeFile" if Explorer displays it so)? But I need to do it in .NET and I want the full path (D:/Temp/Foobar.xml and not just F...

How to detect if two files are on same "volume"?

I'm trying to use System.IO.File.Replace to update a file, and it's throwing System.IOException if the destination file is on a NAS. According to MSDN, if the destination file is on a different volume, this method throws an exception. It's right, but how do I detect if two files are on "different volumes"? Path.GetPathRoot returns diff...

Best "official" scripting language for Windows programmers

Suppose there were several projects mostly maintained by smart interns, who eventually leave after a period of time. Scripts are used here and there in key parts, for example, to back up a database, rename it, zip it, move it over ssh, unzip it, and then to restore it with different settings. You know, the scripting stuff. The programmi...

C#: How to validate domain credentials?

i want to validate a set of credentials against the domain controller. e.g.: Username: STACKOVERFLOW\joel Password: splotchy Method 1. Query Active Directory with Impersonation A lot of people suggest querying the Active Directory for something. If an exception is thrown, then you know the credentials are not valid - as is suggested ...

Is there any way to detect, through WSH, which workstations, in a windows domain, has a locked session?

Is there any way to detect, through WSH, which workstations, in a windows domain, has a locked session? ...

Windows Server 2008 VPN Client

I have a VPN connection set up on my Windows Server 2008 machine. I can connect once I have logged-in to the machine, but I cannot connect prior to logon. The option to connect prior to logon does not appear on the login screen after ctl-alt-del. Any suggestions? Trying to set up Win Server 2008 as a developer desktop. ...

batch file to keep one of ten lines

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...

How to list physical disks?

How to list physical disks in windows? In order to obtain a list of "\.\PhysicalDrive0" available. ...