Yes.There's no big difference when you use WMI classes through the activex objects?But after I saw this code started to wonder if it is necessary to create WMI objects to the time? Both javascript and vbscript have a good set date/time functions. True, but look at the output from this little snippe...
Reread the recent Ctrl-Z Blues topic. You contributed towards the end, but I recommend reading the whole thing from the beginning. You’ll find out more about Ctrl-Z than you ever wanted to know!
Hi Carlos, I updated my code with your suggestion. And the program now exits more cleanly when the last line of output is reached. I’ve often thought of writing a better version with features like inverted ranges, numbered lines with padded zeros, and support for long lines, etc. But to implement so...
Thanks for the pointers, npocmaka. But this thread on a Russian forum proved to be instructive. Retouching the script I found there, I ended up with: set ^"js=javascript:close(new ActiveXObject('Scripting.^ FileSystemObject'^).GetStandardStream(1^).Write(new String(new ^ Enumerator(new ActiveXO...
Hi Guys, First off, thanks to aGerman for explaining the makecab hack. I wouldn’t have thought of that in a million years! How did Carlos even think of it? I hereby nominate Carlos for promotion to Expert. Any seconds? Next up, Dave Benham wrote: What really blows me away is that SET /P can read bot...
Hello Carlos! Slice was one of the first Batch programs I tried to write. I couldn’t output the lines verbatim so I asked for help on the alt.msdos.batch.nt newsgroup and a long, rambling thread unfolded. Your program was one of several submitted. Now that I have a better idea of what I’m doing, I c...
Welcome to DosTips, Dave! Penpen’s answer is probably overkill for your requirements. Below is a little snippet that stores a tab in a variable along with an example of how to use it. Should work with any version of Windows from XP onwards. for /f "delims=" %%t in ('mshta ^"javascript...
Hello All! Wow! What a fascinating thread. Allow me to tie up a few loose ends. I thought Penpen’s final version of CreateNul.cmd was definitive… and then I saw Carlos’s optimisation of my snippet. I’m going to be controversial and call it a draw! Squashman, I think this is the post on forfiles you ...
Hi Again! I wondered why nobody replied to my posts. Then I realised Foxi was talking about square brackets in the filename and not the parentheses around the name clause of the wmic command. Anyways, here’s my mshta solution which is very much in vogue these days thanks to npocmaka and Einstein1969...
Hello All! Taking from DT: Another Way to Create a Linefeed Variable and SO: How to Write a Single Space to a Text File , I came up with this little snippet: @echo off & setlocal enableextensions (set lf=^ ) set nl=^^^%lf%%lf%^%lf%%lf% set "lfFile=%tmp%\lf.tmp" set "lfUTF=%tmp%\lf...
Hi Endoro! Great question. Turns out the equals sign after name must be caret-escaped: X:\> set "fn=%cd%\tom, dick & harry.txt" X:\> type nul >"%fn%" X:\> for /f "skip=1" %f in (' More? wmic datafile where (name^="%fn:\=\\%"^) get lastmodified More? ') do ...
Hello All! I combined AiroNG’s parentheses and Penpen’s backslash-escape techniques and ended up with something like this: X:\> set "fn=%cd%\tom, dick & harry.txt" X:\> type nul >"%fn%" X:\> wmic datafile where (name="%fn:\=\\%") get lastmodified LastModified 201401...
Hi Again! Thanks to everyone who answered. And apologies for not replying sooner. I was having a little break… Anyways, I plundered some code from one of the links Squashman suggested and came up with this snippet that finds the longest line in a file: @echo off & setlocal enableextensions enabl...