Search found 14 matches
- 25 Jun 2024 09:03
- Forum: DOS Batch Forum
- Topic: Echo variables with space
- Replies: 1
- Views: 10013
Echo variables with space
Hi, I'm trying to create a script to remove desktop shortcuts via GPO, I have the following code: @echo off set "shortcut=Adobe Acrobat.lnk Firefox.lnk Google Chrome.lnk Google Earth Pro.lnk" for /d %%a in (%shortcut%) do ( echo %%a ) Which is returning to me as follows: Adobe Acrobat.lnk Firefox.ln...
- 12 Jun 2024 11:20
- Forum: DOS Batch Forum
- Topic: set variable multiple value [SOLVED]
- Replies: 2
- Views: 39359
Re: set variable multiple value
thank you very much
- 12 Jun 2024 08:03
- Forum: DOS Batch Forum
- Topic: set variable multiple value [SOLVED]
- Replies: 2
- Views: 39359
set variable multiple value [SOLVED]
Hi, I'm trying to create a batch file script to save all the folders within C:\Users that contain student name in a variable, I managed to get to the point where I return the folder name but I couldn't save the name of more than a folder in the same variable. EX: C:\Usuários\Aluno1 C:\Usuários\Aluno...
- 04 Sep 2018 06:12
- Forum: DOS Batch Forum
- Topic: Create a script to add a user to certain windows groups
- Replies: 2
- Views: 4229
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...
- 03 Sep 2018 13:39
- Forum: DOS Batch Forum
- Topic: Create a script to add a user to certain windows groups
- Replies: 2
- Views: 4229
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 ...
- 31 Aug 2018 07:12
- Forum: DOS Batch Forum
- Topic: Print Result in Variable Obtained by for
- Replies: 6
- Views: 7065
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...
- 29 Aug 2018 13:35
- Forum: DOS Batch Forum
- Topic: Print Result in Variable Obtained by for
- Replies: 6
- Views: 7065
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 ...
- 28 Aug 2018 17:00
- Forum: DOS Batch Forum
- Topic: Print Result in Variable Obtained by for
- Replies: 6
- Views: 7065
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'...
- 28 Aug 2018 14:32
- Forum: DOS Batch Forum
- Topic: Print Result in Variable Obtained by for
- Replies: 6
- Views: 7065
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 "...
- 28 Aug 2018 11:51
- Forum: DOS Batch Forum
- Topic: echo text %% [SOLVED]
- Replies: 2
- Views: 3509
Re: echo text %%
Thank you very much.Squashman wrote: ↑28 Aug 2018 11:41Double the percent symbols.
Code: Select all
echo for /l %%%%w in (1,1,20) do mode con:cols=67 lines=%%%%w>mybat.bat
- 28 Aug 2018 11:39
- Forum: DOS Batch Forum
- Topic: echo text %% [SOLVED]
- Replies: 2
- Views: 3509
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...
- 13 Nov 2017 07:13
- Forum: DOS Batch Forum
- Topic: find text in file .JSON [SOLVED]
- Replies: 5
- Views: 11189
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 ...
- 12 Nov 2017 09:35
- Forum: DOS Batch Forum
- Topic: find text in file .JSON [SOLVED]
- Replies: 5
- Views: 11189
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...
- 10 Nov 2017 06:10
- Forum: DOS Batch Forum
- Topic: find text in file .JSON [SOLVED]
- Replies: 5
- Views: 11189
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, ...