Windows 10: Bat script to select a folder and update the path in a bat file

Discus and support Bat script to select a folder and update the path in a bat file in Windows 10 Support to solve the problem; How do I combine this scripts? i want the highlighted folder path to been passed in to the script that's been generated (rensa_datafiler.bat) Its... Discussion in 'Windows 10 Support' started by qwerty95, May 15, 2021.

  1. qwerty95 Win User

    Bat script to select a folder and update the path in a bat file


    How do I combine this scripts? i want the highlighted folder path to been passed in to the script that's been generated (rensa_datafiler.bat) Its begins with you select a folder: @Echo off Title Folder Selection echo( Select folder . . . call:FolderSelection "%SourcePath%", SourcePath, "Select Folder" echo( : "%SourcePath%" pause EXIT Rem --------------------------------------------------------------------------------------------------------- :FolderSelection <SelectedPath> <folder> <Description> SetLocal & set "folder=%~1" set "dialog=powershell -sta "Add-Type -AssemblyName System.windows.forms^ |Out-Null;$f=New-Object System.Windows.Forms.FolderBrowserDialog;$f.SelectedPath='%~1';$f.Description='%~3';^ $f.ShowNewFolderButton=$false;$f.ShowDialog();$f.SelectedPath"" for /F "delims=" %%I in ('%dialog%') do set "res=%%I" EndLocal & (if "%res%" EQU "" (set "%2=%folder%") else (set "%2=%res%")) exit/B 0 Rem --------------------------------------------------------------------------------------------------------- And the other script thats replacing the text: @Echo off &setlocal set "search=SoekVaeg" set "replace=test" set "textfile=template.bat" set "newfile=rensa_datafiler.bat" (for /f "delims=" %%i in ('findstr /n "^" "%textfile%"') do ( set "line=%%i" setlocal enabledelayedexpansion set "line=!line:%search%=%replace%!" echo(!line! endlocal ))>"%newfile%" type "%newfile%" Thanks in advance

    :)
     
    qwerty95, May 15, 2021
    #1
  2. Lucasonas Win User

    BAT file/Script to find and replace files

    Hi, innovative thinkers! I am looking for a BAT file or script that takes random named zips, consisting of 5 random numerals in the name, and renames the zips identical to different .txt files with that same 5 numeral in the same folder.

    Here is an example of what I mean:

    BEFORE BAT

    C:\Documents

    45678_Example_720p.zip
    34284_Example_720p.zip
    67483_Example_720p.zip

    RAT_Example_45678_24f_ONO.txt
    RAT_Example_34284_24f_ONO.txt
    RAT_Example_67483_24f_ONO.txt

    AFTER BAT

    C:\Documents

    RAT_Example_45678_24f_ONO.zip
    RAT_Example_34284_24f_ONO.zip
    RAT_Example_67483_24f_ONO.zip

    RAT_Example_45678_24f_ONO.txt
    RAT_Example_34284_24f_ONO.txt
    RAT_Example_67483_24f_ONO.txt

    I would like the BAT to take only those matching 5 numerals as a reference.

    Thanks

    *Oh Well Bat script to select a folder and update the path in a bat file :eek:hwell:
     
    Lucasonas, May 15, 2021
    #2
  3. Lucasonas Win User
    BAT file/Script to find and replace files

    FordGT90Concept!!!

    Your attachment is very close, it kept all the 5 numerals intact, but like you said: "it will rename them all from "#_Example_720p.zip" to "RAT_Example_#_24f_ONO.zip"...

    Greetings, Streetfighter 2

    I can't seem to get the BAT to work, but I'll still keep on trying.


    Any other suggestions, or BAT scripts Streetfighter & FordGT90Concept?
     
    Lucasonas, May 15, 2021
    #3
  4. NinjaNife Win User

    Bat script to select a folder and update the path in a bat file

    BAT file/Script to find and replace files

    Hey guys. Not sure if this is the correct forum, since this doesn't have to do with HTML or anything, so if it is in the wrong place please let me know (or move it if you can).

    I am looking for a BAT file or script (preferably BAT file) that can find files with a specific name and overwrite them with one example file (located in the same folder as the BAT file). Here is an example of what I mean:

    There are 10 files, all located in different folders in the same tree and its branches. At the top, there is "File_A", and below it are "File_A" copies, but they are older versions (same file name, different data in the file). I need the something that will search all the sub-directories, find all of the copies of "File_A", and replace it with the new version ("File_A" located at the top of the tree).

    Wow, that made a lot more sense before I tried typing it lol. If you have any questions I will do my best to answer them, but I don't have much experience with this stuff.. Any help would be greatly appreciated. Thanks *Smile Bat script to select a folder and update the path in a bat file :)


    Brendan "NinjaNife" West
     
    NinjaNife, May 15, 2021
    #4
Thema:

Bat script to select a folder and update the path in a bat file

Loading...
  1. Bat script to select a folder and update the path in a bat file - Similar Threads - Bat script select

  2. Bat file

    in Windows 10 Gaming
    Bat file: I have a bat fileI am improving it bit by bit till I have reached But not i have added a warning to it before a commandI now want to make that line font size Bigger than the others How can I do that ??So here is the Batch file content@ECHO OFF echo...
  3. Bat file

    in Windows 10 Software and Apps
    Bat file: I have a bat fileI am improving it bit by bit till I have reached But not i have added a warning to it before a commandI now want to make that line font size Bigger than the others How can I do that ??So here is the Batch file content@ECHO OFF echo...
  4. Create a .bat or script file for the following actions.

    in Windows 10 Network and Sharing
    Create a .bat or script file for the following actions.: So I have a app called AltServer that occasionally "dies" and doesn't work with my phone. So a "fix" I "found" is to kill the old, the currently running Altserver.exe and rerun Altserver.exe with administrator privileges. So, can anyone help me create a .bat file or some kind...
  5. .bat script for killing specific Process ?

    in Windows 10 Ask Insider
    .bat script for killing specific Process ?: I need script that when i open script.bat file it automattically kills process items with specific name like kill web1.exe , text1.exe. without any user input. thanks. submitted by /u/Puzzled_Waltz326 [link] [comments]...
  6. .bat files

    in Windows 10 Network and Sharing
    .bat files: So i am trying to make a minecraft server and need to open a .bat file but i keep getting a error saying "This app can not run on this pc" But it worked a month ago i need a solution please....
  7. Bat file

    in Windows 10 Ask Insider
    Bat file: Good morning/evening/night, I wanted to create a batch file or an exe that can change options inside the gui of an application (the application is cisco webex) (if you are familliar with webex i want to change the audio or turn it to music mode witha batch file) but i am...
  8. Path Entries with BAT or REG

    in Windows 10 Software and Apps
    Path Entries with BAT or REG: Hey guys i have a question about path entries, i added this 5 path items in the rectangle by hand [img] is there a command line parameter that will add them with one command ? and is there a way to do it with a reg file? thanks 164858
  9. .bat file

    in Windows 10 Customization
    .bat file: I have .bat file it is not working in my new PC when I double click on it. but it was working in my old PC. could your please support how to associate .bat file in windows 10? Kindly looking for your support and reply in this regards. Thanks.....
  10. .bat files changed?

    in Windows 10 Ask Insider
    .bat files changed?: Greetings. Regarding Windows 10. I have a .bat file that I've used for... well, since forever. It rarely changes and it hasn't changed in months. Despite running quite fine in its current incarnation for some months now it's quite recently it's began throwing the error:...