Search found 30 matches

by tobwz
04 Mar 2024 01:45
Forum: DOS Batch Forum
Topic: How to compare 2 modified file timestamps?
Replies: 6
Views: 2591

Re: How to compare 2 modified file timestamps?

@Aacini: Thank you for your code although it does not work but the idea is good. I adjusted the code a little: @echo off setlocal EnableDelayedExpansion set "files=aaaa.dat;bbbb.dat" set "older=" for /F "delims=" %%a in ('dir *.dat /B /O:-D') do ( echo current a=%%a if "!files:%%a=!" neq "%files%" s...
by tobwz
28 Feb 2024 10:54
Forum: DOS Batch Forum
Topic: How to compare 2 modified file timestamps?
Replies: 6
Views: 2591

How to compare 2 modified file timestamps?

Assume I have 2 files aaaa.dat and bbbb.dat

How can I find out from DOS batch file which of the two files has an older last modified timestamp?
by tobwz
28 Feb 2024 07:10
Forum: DOS Batch Forum
Topic: How to wrap filename with blanks inside?
Replies: 1
Views: 1586

How to wrap filename with blanks inside?

In a DOS batch script I wrote a command to start a powershell command: Powershell.exe -noprofile -noexit -command "& {D:\tmp\testargs.ps1 %args%}" As long as the filename does not contain any blanks the command above works. As soon as it contains blanks I have a problem. The following does not work:...
by tobwz
01 Jan 2024 08:45
Forum: DOS Batch Forum
Topic: How to copy ONLY timestamps from file 1 and apply them to file 2 ?
Replies: 0
Views: 9054

How to copy ONLY timestamps from file 1 and apply them to file 2 ?

How can I easily (!) copy timestamps (created, last modified) from file 1 to another file 2?

Again: I don't want to copy file 1 itself but only the timestamps
by tobwz
09 Dec 2022 04:39
Forum: DOS Batch Forum
Topic: How to move location of user shell folder Documents, Downloads,Pictures,....
Replies: 1
Views: 6641

How to move location of user shell folder Documents, Downloads,Pictures,....

As you know Windows 10 has special user folders for each user e.g. MyDocuments Downloads MyPictures MyMusic ..... They point all to sub folders of the current user profile e.g C:\Users\<username>\.... But these are only symbolic links to the real folders. How can I change the target folder for e.g. ...
by tobwz
30 Sep 2022 00:38
Forum: DOS Batch Forum
Topic: Need batch script version of this complex command
Replies: 2
Views: 1873

Need batch script version of this complex command

At the bottom of this posting you can see a complex command to let Windows 10 show a couple of version+build info about the current WinOS. It works when directly entered at the command prompt. But when I put it into a batch script a couple of errors occur. What do I have to change to be able to run ...
by tobwz
25 Sep 2022 11:41
Forum: DOS Batch Forum
Topic: "move" command WITH prompt if target exists?
Replies: 2
Views: 1889

"move" command WITH prompt if target exists?

Ok, I could move one or multiple files or folders on the command line in a batch script by a command like move /y \"%1\" \"D:\mydata\\" Unfortunately all files/folders are moved regardless if the target files/folders exist or not. How can I extend the command above so that a prompt appears if the fi...
by tobwz
13 Jun 2022 10:03
Forum: DOS Batch Forum
Topic: How to put path with blanks into "for" command? Masking & quotes
Replies: 9
Views: 6757

Re: How to put path with blanks into "for" command? Masking & quotes

Yes, 1000%.
I copied again the whole path from File Explorer into batch script
...same error.

And I verified it in another way:

if I eliminate the blank in path in File Explorer folder name and in script variable assignment
.... it works
by tobwz
13 Jun 2022 01:39
Forum: DOS Batch Forum
Topic: How to put path with blanks into "for" command? Masking & quotes
Replies: 9
Views: 6757

How to put path with blanks into "for" command? Masking & quotes

Assume I want to execute a command like the following from within a DOS batch script: for /F "Tokens= Usebackq" %%G in (' "D:\some\path\with blanks inside\myprog.exe" -p "......" %1') do set "....." then I get an error like: 'D:\some\path\with' is not recognized as an internal or external command,op...
by tobwz
29 Apr 2022 13:11
Forum: DOS Batch Forum
Topic: How to define screen buffer size for "Mode 120,60" command?
Replies: 8
Views: 7255

Re: How to define screen buffer size for "Mode 120,60" command?

You should test, whether or not the error text really is misleading. Since the buffer is set first, it might be smaller than the actual window size at that point: powershell.exe -noprofile -command "&{Write-Host "initial WindowSize $(get-host).UI.RawUI.WindowSize"; $w=(get-host).ui.rawui;$w.buffers...