Search found 539 matches
- 05 Sep 2023 04:32
- Forum: DOS Batch Forum
- Topic: Safer way to parse curl output?
- Replies: 4
- Views: 22408
Re: Safer way to parse curl output?
Thank you so much, Aacini - this way is very slick!!! I'll use this. Thanks again! This is the way I would do it: @echo off setlocal set "CurlResp={"device_code":"f00b07aab09048268c78787c7f878787","user_code":"HFYRBFJF","verification_uri":"https://idcs-zzzzzzzzzzd.identity.cloud ... es_in":300}" rem...
- 29 Aug 2023 07:31
- Forum: DOS Batch Forum
- Topic: Safer way to parse curl output?
- Replies: 4
- Views: 22408
Safer way to parse curl output?
HI All - I have the following piece of code that is working as expected. FOR /F "tokens=2,4 delims=:," %%A IN (' curl --location --request POST "%IDCS_URL%/oauth2/v1/device" ^ --header "Content-Type: application/x-www-form-urlencoded;charset=utf-8" ^ --data-urlencode "response_type=device_code" ^ --...
- 10 Aug 2023 09:14
- Forum: DOS Batch Forum
- Topic: Trouble with ROBOCOPY - copy files to destination that don't already exist
- Replies: 2
- Views: 1787
Trouble with ROBOCOPY - copy files to destination that don't already exist
HI All - I have a few folders & contents (including subdirecotries) I need to copy from source to target. I need to do this frequently but what's happening is that it's copying everything each time I run the ROBOCOPY. I've tried to modiy it but having no luck. Here's what I have: ROBOCOPY "source" "...
- 21 Jul 2023 02:39
- Forum: DOS Batch Forum
- Topic: Clearing an array is done as a partial match? Why?
- Replies: 1
- Views: 1126
Clearing an array is done as a partial match? Why?
HI All - I have the following Array/List setup. The first position in the list is a filename mask. What's interesting is if I have 2 like file names but still unique, when I clear the array before each iteration, the other like array definition is cleared too. For instance, when running the below co...
- 28 May 2023 08:29
- Forum: DOS Batch Forum
- Topic: How to clear an array?
- Replies: 9
- Views: 4887
How to clear an array?
Hi Guys - This may be a silly question, but is there a way to clear an array without looping through and explicitly clearing each value? THis is what I'm doing now: REM Clear Array FOR /L %%A IN (1,1,100) DO ( SET "STR[DC%%~A].DLR=" SET "STR[DC%%~A].LOC=" SET "STR[DC%%~A].IMP=" ) I'm hoping there's ...
- 11 Feb 2022 10:34
- Forum: DOS Batch Forum
- Topic: How to spool batch script logic to create another batch script but not expanded?
- Replies: 5
- Views: 5391
Re: How to spool batch script logic to create another batch script but not expanded?
HI Squash & Team - Yes, you're right. I'm sorry. It was the last paren in the for loop causing the issue, I should have known. Final : SETLOCAL ENABLEDELAYEDEXPANSION SET "EXCLUSION_LIST=Automation_Parameters.ps1,Encrypt_Credentials.ps1,Download_Backup.ps1" SET "EXT=cmd" REM Read PS1 files from this...
- 06 Feb 2022 05:54
- Forum: DOS Batch Forum
- Topic: How to spool batch script logic to create another batch script but not expanded?
- Replies: 5
- Views: 5391
Re: How to spool batch script logic to create another batch script but not expanded?
THanks, Terry! That did the trick, but having one issue where when trying to redirect a for loop command, it's recognizing the DO. Here is my almost finished code: @ECHO OFF REM Read PS1 files from this directory PUSHD "..\PS1" FOR %%A IN ("*") DO ( REM Ensure cmd is purged before writing to it DEL ...
- 06 Feb 2022 05:19
- Forum: DOS Batch Forum
- Topic: How to spool batch script logic to create another batch script but not expanded?
- Replies: 5
- Views: 5391
How to spool batch script logic to create another batch script but not expanded?
Hi Guys - I have the following piece of code that I need to spool to another batch script. However, when I redirect, the functions/variables are done so expanded which isn't right. I need to pool this piece of code to "Testbatch.cmd": >>"..\Batch\TestBatch.cmd" ( @ECHO OFF SET "Script=%~n0" FOR /F %...
- 03 Jan 2022 04:34
- Forum: DOS Batch Forum
- Topic: How to arrange and array/list?
- Replies: 3
- Views: 2912
Re: How to arrange and array/list?
I suppose I was over thinking. I can force the order I need to process the files in based on my array definition. Here is what I came up with and it works, but not sure if this is considered "too clunky". I'm sure there are better ways? @echo off setlocal EnableDelayedExpansion SET "FILE_BIN=C:\TEMP...
- 03 Jan 2022 02:36
- Forum: DOS Batch Forum
- Topic: How to arrange and array/list?
- Replies: 3
- Views: 2912
Re: How to arrange and array/list?
Squash - Either my explanation wasn't good enough or you're still hitting the egg-nog. Dave's JSORT solution does not work for me in this situation. I'm not looking to sort file contents or files themselves. As stated, I'm using the 4th position in my array/list definition to dictate how I need to p...
- 02 Jan 2022 17:54
- Forum: DOS Batch Forum
- Topic: How to arrange and array/list?
- Replies: 3
- Views: 2912
How to arrange and array/list?
Hi Folks - I have the following array (well, I believe it's technically called a "list): @echo off setlocal EnableDelayedExpansion FOR %%A IN ( "CITY.txt|CITY_JOB|CITY_Errors.zip|" "COUNTY.txt|COUNTY_JOB|COUNTY_Errors.zip|2" "REGION.txt|REGION_JOB|REGION_Errors.zip|1" ) DO SET "GROUP=%%~A" & CALL :D...
- 27 Dec 2021 14:33
- Forum: DOS Batch Forum
- Topic: How to force processing of certain files first in for loop?
- Replies: 3
- Views: 2657
Re: How to force processing of certain files first in for loop?
Well, I figured out a way to do it and it's working as expected although not sure if this is an acceptable approach. Essentially, I"m running over the files first before I process them to check an array definition I set. If a specific OLU_TYPE is set, then modfy the data modify. Then, when I begin t...
- 23 Dec 2021 07:20
- Forum: DOS Batch Forum
- Topic: How to force processing of certain files first in for loop?
- Replies: 3
- Views: 2657
Re: How to force processing of certain files first in for loop?
HI Antonio - Yes you're right, allow me to provide some more context! 1. Can be any number of files (1-1000) 2. Can have diferent extensions 3. The "first files" can be processed in any order so long as they are processed BEFORE the others 4. I have a list (or an array) setup which defines the files...
- 23 Dec 2021 02:54
- Forum: DOS Batch Forum
- Topic: How to force processing of certain files first in for loop?
- Replies: 3
- Views: 2657
How to force processing of certain files first in for loop?
HI All - I have a data process I'm building for a client. All files are staged in a single directory so I'm using a for loop to consume all files and process accordingly. However, there are certain files I need to process first just to requirement from within the target application that I"m importin...
- 24 Sep 2021 04:12
- Forum: DOS Batch Forum
- Topic: Array construction with empty value
- Replies: 9
- Views: 6947
Re: Array construction with empty value
Antonio - Thank you very much! I understand now. This certainly increases the risk of errors (if the line isn't truly blank) etc. I will work with it for now and the conver to your other method. Which I have a question on, how do I sent multiple "data" lines? For instance, what if I have 5 "data" li...