Search found 11 matches

by deniscalanca
04 Sep 2018 06:12
Forum: DOS Batch Forum
Topic: Create a script to add a user to certain windows groups
Replies: 2
Views: 812

Re: Create a script to add a user to certain windows groups

Sorry, maybe I did not express myself well, come on, there will be more users that can be set, it will not be user1, it can be any name, user1 was just an example, I usually use the variable as: (set "var1 = var2") so I do not have problems when using space (set "var1 = var test"), so I usually stan...
by deniscalanca
03 Sep 2018 13:39
Forum: DOS Batch Forum
Topic: Create a script to add a user to certain windows groups
Replies: 2
Views: 812

Create a script to add a user to certain windows groups

I'm trying to create a script to outomatize a custom installation of Windows where I put a script at startup and when I initialize the image the first did it perform certain pre-defined actions in the script, one of them would be to define which local groups the user belongs to, initially I tested ...
by deniscalanca
31 Aug 2018 07:12
Forum: DOS Batch Forum
Topic: Print Result in Variable Obtained by for
Replies: 6
Views: 1144

Re: Print Result in Variable Obtained by for

That's because WMIC outputs in Unicode, FOR /F converts it to ANSI encoding but before that, it will strip the LineFeeds and splits the output to individual lines then converts the text, the result is that you end up with orphaned carriage return characters. So the last line that FOR /F passes to t...
by deniscalanca
29 Aug 2018 13:35
Forum: DOS Batch Forum
Topic: Print Result in Variable Obtained by for
Replies: 6
Views: 1144

Re: Print Result in Variable Obtained by for

The ECHO statements are not within the FOR loop, so delayed expansion is not required. Assuming your code really matches your post, the most likely explanation is that user "user1" does not exist, so there are no iterations and the variables are never set. It is easy to check - simply add echo %%a ...
by deniscalanca
28 Aug 2018 17:00
Forum: DOS Batch Forum
Topic: Print Result in Variable Obtained by for
Replies: 6
Views: 1144

Re: Print Result in Variable Obtained by for

You've enabled delayed expansion, but you aren't using it. Change the echo statements to echo !usr1_passwdexpiretmp! echo !usr1_passwordchangeabletmp! I made the exchange and yet the return is: ECHO It's deactivated ECHO It's deactivated I disable delayed expansion and still the return is: ECHO It'...
by deniscalanca
28 Aug 2018 14:32
Forum: DOS Batch Forum
Topic: Print Result in Variable Obtained by for
Replies: 6
Views: 1144

Print Result in Variable Obtained by for

how do I manage to demand the result obtained in the for? @echo off setlocal setlocal EnableExtensions setlocal EnableDelayedExpansion set "usr1_name=user1" for /F "skip=1 delims= " %%a in ('wmic useraccount where name^="%usr1_name%" get passwordexpires') do ( set usr1_passwdexpiretmp=%%a ) for /F "...
by deniscalanca
28 Aug 2018 11:51
Forum: DOS Batch Forum
Topic: echo text %% [SOLVED]
Replies: 2
Views: 595

Re: echo text %%

Squashman wrote:
28 Aug 2018 11:41
Double the percent symbols.

Code: Select all

echo for /l %%%%w in (1,1,20) do mode con:cols=67 lines=%%%%w>mybat.bat
Thank you very much.
by deniscalanca
28 Aug 2018 11:39
Forum: DOS Batch Forum
Topic: echo text %% [SOLVED]
Replies: 2
Views: 595

echo text %% [SOLVED]

Hello, I'm building a batch file that will generate a new .cmd file, I need to send it to this new file through echo: for / l %% w in (1,1,20) do mode with: cols = 67 lines = %% w more in the new file comes out as follows: for /l % w in (1,1,20) do mode with: cols = 67 lines = % w How to send throug...
by deniscalanca
13 Nov 2017 07:13
Forum: DOS Batch Forum
Topic: find text in file .JSON [SOLVED]
Replies: 5
Views: 2891

Re: find text in file .JSON

I see. Maybe FINDSTR would be an option in your case. @echo off &setlocal >nul findstr /rc:"\"show_home_button\":[ ]*true" "%LocalAppData%\Google\Chrome\User Data\Default\Secure Preferences" if errorlevel 1 ( echo not found ) else ( echo found ) pause Steffen Steffen very very good, exactly what I ...
by deniscalanca
12 Nov 2017 09:35
Forum: DOS Batch Forum
Topic: find text in file .JSON [SOLVED]
Replies: 5
Views: 2891

Re: find text in file .JSON

My intention is just to check if there is this "show home button": true in the file. The file in question is Secure Preferences located at "%LocalAppData%\Google\Chrome\User Data\Default\Secure Preferences" My intention is to use this file as a parameter to set some google chrome settings on devices...
by deniscalanca
10 Nov 2017 06:10
Forum: DOS Batch Forum
Topic: find text in file .JSON [SOLVED]
Replies: 5
Views: 2891

find text in file .JSON [SOLVED]

Hello, my name is Denis, I live in Brazil, I am trying to mount a batch file to return me if a certain text exists in a .JSON format file, here is a piece of text that I am trying to capture: { "browser": { "show_home_button": true }, I just want to know if the "show_home_button" line exists: true, ...