Mass changing files’ modification date on Windows

It’s sometimes useful to be able to change a file’s modification date. Linux makes it easy by simply using the “touch” command. I found this rather useful in cases where files were transferred between servers, which unfortunately do not have their times synchronized.

So, how can this be done on Windows?

Here is the command to issue in order to modify a single file’s modification time:

copy filename,,+

But in most cases, you’d be looking at mass-changing the modification date of files inside a certain directory. To do so, use the following command:

for %f in (c:\path\to\folder\*.*) do copy %f,,+

This would loop over all files containing a “dot” (i.e. extension) in c:\path\to\folder, and changes their modification time to the current system time. If for example you want the above to only go through XML files within that folder, then use *.xml instead of *.*

PS: the above command would work if you’re manually issuing it via the command prompt. However, if you’d like to embed that it in a batch file, make sure to replace %f with %%f. In other words, the command would turn into:

for %%f in (c:\path\to\folder\*.*) do copy %%f,,+

Windows “Workstation” service not starting up? read this

At one point in time, I wasn’t able to RDP into a windows host. Despite using the correct credentials, I was greeted with the following error: “Unable to obtain Terminal Server User Configuration”.

I had to physically access the machine and look into the Event Viewer for hints, but not much could be found there.

Next stop: services.msc — this showed that the “Workstation” service is stopped. Starting it up failed.

As a matter of fact, several services that depend on the aforementioned one failed to start (obviously).

Long story short, the following sorted out the issue, but I do not claim it’s a trick that would always work:

  • I opened the registry editor (regedit.exe)
  • Browsed to:
    • HKEY_LOCAL_MACHINE
    • SYSTEM
    • CurrentControlSet
    • Services
    • lanmanworkstation (not lanmanserver)
  • Deleted the following keys:
    • DependOnService
    • DependOnGroup
  • Restarted

While this did the trick, manually interfering with service dependencies is not always a good diea.

 

Enabling telnet in windows vista

Some of you may be missing the good old command-line telnet client. The thing is that vista has this client disabled by default. The good news is that you can easily install/enable it. To do so, follow these steps:

  1. Go to Control Panel
  2. Click on ‘Programs’
  3. Under ‘Programs and Features’, click on ‘Turn windows features on or off’
  4. Wait a bit for the list to be compiled
  5. Tick ‘Telnet client‘ and hit ‘OK’ then wait for it to be installed

You may now open a command prompt and use telnet hostname port

Good luck

Microsoft Office Picture Manager takes a lot of time to load

Is your Microsoft office manager taking way too much time to load?

The reason behind it is that  the picture manager keeps track of the most recently used paths, and if any of these paths is no longer available, the software will stall for a long period.
The most possible scenario is that you have accessed a folder over the network, and you are no longer able to access that location.
The fix is rather simple.

On windows XP, go to c: -> documents and settings -> username (your login) -> local settings -> application data -> Microsoft -> OIS
Open the file ‘oiscatalog.cag’ with our favorite text editor (e.g. notepad) and delete any line pointing to a remote location.
You might as well delete that file, and it will be recreated upon starting the software again.

PS: if you’re on vista, the path to that file is C:\Users\yourusername\AppData\Local\Microsoft\OIS

RPC server unavailable error – Microsoft Internet Connection Sharing (ICS)

Thought of mentioning this as I’ve came across it and noticed many others did too.

If for some reason, whenever you try enabling internet connection sharing (ICS), you get an error saying that the rpc server is unavailable, do the following:

  1. Click on start > run
  2. type services.msc and hit enter
  3. Search for the DHCP Client service, and check its status, it will most probably be stopped.
  4. Double click on this service, change its status to automatic and hit start

that’s it.