Search found 336 matches

by MigrationUser
2021-Jul-26, 8:43 pm
Forum: Windows CMD Shell
Topic: Is there a better option than DIR or LS for listing files?
Replies: 0
Views: 4754

Is there a better option than DIR or LS for listing files?

20 Feb 2021 04:23 Rekrul Many years ago, on the Amiga, I recall having a Dir/LS command that had a staggering number of options. You could format the output in pretty much any way you could think of. I've tried all the options in Dir and I've even downloaded a couple different ports of the Unix LS c...
by MigrationUser
2021-Jul-26, 8:37 pm
Forum: Windows CMD Shell
Topic: Want to use some PS command in Cmd script to set a var
Replies: 0
Views: 4855

Want to use some PS command in Cmd script to set a var

28 Nov 2018 20:08 be :: In cmd script, this line results in display of the text PowerShell "54321" :: In PS console, these twp lines :: result in creation of var and display of its content $x = "54321" $x :: In cmd script, these two lines result in nothing. PowerShell $x = "...
by MigrationUser
2021-Jul-26, 6:21 pm
Forum: Windows CMD Shell
Topic: If branching doesn't work
Replies: 0
Views: 4625

If branching doesn't work

12 Nov 2019 03:12 Shane Greetings, I'm trying to use IF DEFINED to control branching, but it doesn't work. I will start with an example setLocal if defined _var ( :: _var is NOT defined, so the next line should not be executed if %_var%=="test" echo %_var% is defined ) endLocal Processing ...
by MigrationUser
2021-Jul-26, 6:17 pm
Forum: Windows CMD Shell
Topic: ARGH!!! Someone please shoot me now and put me out of my misery!!!
Replies: 0
Views: 3803

ARGH!!! Someone please shoot me now and put me out of my misery!!!

08 Sep 2019 10:12 Rekrul The more I try to write complex scripts, the more I have a burning hatred for whoever designed this broken mess. I have this code in my script; if !width! gtr 640 set width=1280 if !width! gtr 540 (if !width! leq 640 set width=640) if !width! gtr 500 (if !width! leq 540 set ...
by MigrationUser
2021-Jul-26, 6:09 pm
Forum: Windows PowerShell
Topic: Where-Object gives two different results using a equivalent syntax
Replies: 0
Views: 14407

Where-Object gives two different results using a equivalent syntax

16 Dec 2020 22:55 RedHut I'm trying to understand why I get a different result from the two equivalent where-object syntax. Basically I get a different result from using ? {$_.CreationTime -lt $_.LastWriteTime} versus ? CreationTime -lt LastWriteTime on a file object. Here is the test case which giv...
by MigrationUser
2021-Jul-26, 5:58 pm
Forum: Windows CMD Shell
Topic: How to eliminate NUL (0x00) characters from file or from a string.
Replies: 0
Views: 3862

How to eliminate NUL (0x00) characters from file or from a string.

21 Feb 2021 02:18 nomad My dilemma starts with the output of WMIC command. I am trying to get the whole command line of a PID with this command : wmic process where processID=12345 get commandLine > command.txt and the output I get looks something like this: _C o m m a n d L i n e n o t e p a d q . ...
by MigrationUser
2021-Jul-26, 7:48 am
Forum: Windows CMD Shell
Topic: Substring operations don't work with spaces?
Replies: 0
Views: 2450

Substring operations don't work with spaces?

22 Feb 2021 10:47 Rekrul I'm writing a routine to reformat numbers to include commas as dividers and I've run into something odd; @echo off set size=1234 set size=xxxxxxxxxxxx%size% echo %size:~-9,-6% set size=1234 set size= %size% echo %size:~-9,-6% The first one prints "xxx" as it should...
by MigrationUser
2021-Jul-26, 12:17 am
Forum: Windows CMD Shell
Topic: IF/ELSE vs. multiple IFs?
Replies: 0
Views: 2583

IF/ELSE vs. multiple IFs?

11 Feb 2021 09:03 Rekrul When testing multiple conditions, is there any advantage to nesting multiple IF comparisons using ELSE, rather than simply using multiple IF lines? In other words, is there any advantage to using this; if x equ %1% (echo ONE) else (if %x% equ 2 (echo TWO) else (if %x% equ 3 ...
by MigrationUser
2021-Jul-25, 11:55 pm
Forum: Windows CMD Shell
Topic: FOR /F command bug: unexpected tokenization of "equal" character
Replies: 0
Views: 2693

FOR /F command bug: unexpected tokenization of "equal" character

06 May 2021 09:11 dvx Something in the FOR /F processing of a 'command string' is eliding the = character. The command is ECHO, with the string A=5 C:>ECHO A=5 C:>A=5 But when used as a FOR /F command string, the '=' character is converted to a space: C:>FOR /F %R IN ('ECHO A=5') DO ECHO %R C:>ECHO ...
by MigrationUser
2021-Jul-25, 11:46 pm
Forum: Windows CMD Shell
Topic: Please explain this: for %%a in ("%path:;=" "%") do @echo %%~a
Replies: 0
Views: 3008

Please explain this: for %%a in ("%path:;=" "%") do @echo %%~a

20 Jan 2018 01:30 ronczap I know this works great to parse the PATH environment variable and shows each path on a separate line but I don't understand the syntax or how it works. It obviously is parsing the path variable using the semicolon to split the string. I can't find any info on Microsoft Tec...