Search found 4317 matches

by Squashman
24 Dec 2021 11:16
Forum: DOS Batch Forum
Topic: getting current, parent directory name with a special & letter
Replies: 13
Views: 7532

Re: getting current, parent directory name with a special & letter

with "ZZ2=%ZZ2:~0,-1%" or not with ZZ2=%ZZ2:~0,-1% if you run this batch c:\abc\xx&yy\ it can display this "%~dp0" but this doesnt run it and causes an error at xx You only addressed one of the three points of my previous comment. As I said in my first comment, you either have to echo the variable ...
by Squashman
24 Dec 2021 10:56
Forum: DOS Batch Forum
Topic: Obfuscate code.
Replies: 19
Views: 10173

Re: Obfuscate code.

MauricioDeAbreu wrote:
24 Dec 2021 09:02
For / f "tokens = *" %% f in ('wmic diskdrive get size / value ^ | find "="') do set "%% f"
The for variable references should not have a space. Nor should the tokens option.
by Squashman
23 Dec 2021 15:24
Forum: DOS Batch Forum
Topic: getting current, parent directory name with a special & letter
Replies: 13
Views: 7532

Re: getting current, parent directory name with a special & letter

Nothing in your code suggests any problems with exclamation points. Also the code will have no problems processing folder names with ampersands. The only problem you would have is using echo with a variable that has an ampersand. Use quotes around the variable when echoing it or escape the ampersand...
by Squashman
23 Dec 2021 15:16
Forum: DOS Batch Forum
Topic: Problem with obfuscator
Replies: 4
Views: 4670

Re: Best way to obfuscate a Batch File?

I know that topic is very very old but, @dbenham, can u please help me with your obfuscator? I created a batch file (for me very important over 1400 lines), and when I'm executing the obfuscator this happens: "JScript runtime error: Invalid procedure call or invalid argument" :cry: Do you have the ...
by Squashman
23 Dec 2021 14:20
Forum: DOS Batch Forum
Topic: Obfuscate code.
Replies: 19
Views: 10173

Re: Obfuscate code.

Why aren't you using Dbenham Obfuscator.bat
viewtopic.php?f=3&t=7990&start=15#p53278
by Squashman
22 Dec 2021 16:54
Forum: DOS Batch Forum
Topic: split string into substrings based on delimiter
Replies: 44
Views: 89326

Re: split string into substrings based on delimiter

I discovered a new simpler (and clearer) method to assign values to several variables in the same line. I think this is the simplest way to do it: True but not as dynamic. If I wanted to add another sub version all I have to do is edit the two variables. @echo off setlocal EnableDelayedExpansion se...
by Squashman
14 Dec 2021 15:13
Forum: DOS Batch Forum
Topic: Finding /? in arguments
Replies: 7
Views: 5068

Re: Finding /? in arguments

You can use also Google as a search engine. just add site:dostips.com in the search bar after whatever you want to search for. Yeah, it does not work like this. Google cannot search punctuation marks and non alphanumeric symbols except for . and , ... And this is true to all major engines iikr. Tha...
by Squashman
13 Dec 2021 11:04
Forum: DOS Batch Forum
Topic: Memory size per slot / Tamaño de memoria por ranura
Replies: 11
Views: 6925

Re: Memory size per slot / Tamaño de memoria por ranura

@ECHO OFF SET "DIMM1=" SET "DIMM2=" for /F "tokens=2 skip=2 delims=," %%G IN ( '"wmic memorychip get devicelocator,capacity /format:csv"' ) do ( IF NOT DEFINED DIMM1 ( set "DIMM1=%%G" ) ELSE ( IF NOT DEFINED DIMM2 SET "DIMM2=%%G" ) ) IF DEFINED DIMM1 echo DIMM1 Capacity: %DIMM1% IF DEFINED DIMM2 ec...
by Squashman
13 Dec 2021 09:35
Forum: DOS Batch Forum
Topic: Memory size per slot / Tamaño de memoria por ranura
Replies: 11
Views: 6925

Re: Memory size per slot / Tamaño de memoria por ranura

So you want that output assigned to a variable. That is easy. But what else are going to continue to ask for. We are not going to sit here for a few days and weeks and keep providing answer to your code request if you are not going to make any effort yourself to even attempt to do it yourself.
by Squashman
12 Dec 2021 16:47
Forum: DOS Batch Forum
Topic: Memory size per slot / Tamaño de memoria por ranura
Replies: 11
Views: 6925

Re: Memory size per slot / Tamaño de memoria por ranura

I am not sure I am following what you are talking about. The code will show the capacity of each stick of ram installed in the computer. If there is 2 sticks installed it will show two lines of output. Feel free to add devicelocator to that WMIC command.
by Squashman
07 Dec 2021 08:33
Forum: DOS Batch Forum
Topic: Simple Counter Issue
Replies: 10
Views: 5664

Re: Simple Counter Issue

How about you start counting at zero instead.

Code: Select all

set /a "numApps=0"
Otherwise you already have one app before the code even executes.
by Squashman
07 Dec 2021 07:58
Forum: DOS Batch Forum
Topic: add parentheses and batch gives error
Replies: 3
Views: 2881

Re: add parentheses and batch gives error

You need to enable delayed expansion and use the exclamation point to reference the variable values. I have also cleaned up your code and used best practices with each command. @ECHO OFF for /f "usebackq tokens=1 delims=;" %%A in ("C:\test.txt") do ( set "d=%%A" setlocal enabledelayedexpansion echo ...
by Squashman
06 Dec 2021 20:57
Forum: DOS Batch Forum
Topic: Adding Serial Number while rename files through MS-Dos
Replies: 4
Views: 3383

Re: Adding Serial Number while rename files through MS-Dos

Asim, Your technical specifications for what you wanted to accomplish was extremely lacking. If I was given this little information I would be giving this back to my business analysts to rewrite it. Please be more specific with what you want to accomplish. Provide complete input and output examples.