# Windows Batch

11K

Solutions

11K

Contributors

Batch files are text files containing a script of commands that are executed by the command interpreter on DOS, OS/2 and Windows systems. Most commonly, they are used to perform a series of functions that are repeated -- copying a set of files created daily with one step, for example.

Hi,

I have a textfile (tab separated), I want duplicate KeyNR to be joined according to the last field.

So I have:

FirstNM        LastNM        KeyNR        Group        Location
John              Doe1            6576            Testgrp      1
John              Doe2            6543            Testgrp      3
John              Doe4            3243            Testgrp      3
John              Doe1            6576            Testgrp      3,4
John              Doe2            6543            Testgrp      2

I want this to result in:

FirstNM        LastNM        KeyNR        Group        Location
John              Doe4            3243            Testgrp      3
John              Doe1            6576            Testgrp      3,4,1
John              Doe2            6543            Testgrp      2,3

As you can see the second and the fifth line and the first and the fourth have the same key, the location needs to be merged with a comma in between.
0
Guys,
I saw some script that in our applications server has the gawk.exe with parameter as  below, do anyone here familiar with gawk and mind to explain what is this parameter does ?

gawk.exe "!x[$0]++" 0 Our company is setting up around 100 notebooks to connect to the company WiFi with WPA2 pre share key, as an alternative for connecting to the wired network. The WiFi admin wants to distribute the pre share key automatically and transparently instead of informing users to input the key. I found that Microsoft did not support the key to be sent thru GPO policy. Is there any other way for doing that? e.g. running some scripts when user logon to the domain... Please advise. Thanks. 0 Hello, Can you please help with a batch or VB Script, I need to remove from all file names in a a folder (with sub Folders) .[mail@xxx.bz].gryphon Example db.opt.[mail@xxx.bz].gryphon dbver.[mail@xxx.bz].gryphon palrtres.frm.[mail@xxx.bz].gryphon Should be db.opt dbver palrtres.frm Your help is greatly appreciated. 0 Hi All, Greetings... According to my work, I need to zip files present in a folder using batch script without using any 3rd party software. I tried with below code ,but getting the error.error also attached below. Any help regarding this would be highly appreciated. 'Get command-line arguments. Set objArgs = WScript.Arguments Set FS = CreateObject("Scripting.FileSystemObject") InputFolder = FS.GetAbsolutePathName(objArgs(0)) ZipFile = FS.GetAbsolutePathName(objArgs(1)) 'Create empty ZIP file. CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar) Set objShell = CreateObject("Shell.Application") Set source = objShell.NameSpace(InputFolder).Items objShell.NameSpace(ZipFile).CopyHere(source) 'Required! wScript.Sleep 2000  This code is present in zip.vbs file. We have to zip the files into Outputfile.zip file. in command prompt , I have entered below command C:\Users\abc>Cscript zip.vbs input path output path\OutputFile.zip While executing this ,I got below error. " Path not found error" for both the input and output file path. It will be helpful if anyone corrects me the mistake which I made in this script. 2 I have thousands of folders that I need to relocate to other folders based on a portion of the folder name. The folders look like this: M:\Blah Blah\Blahty\Blah Blah\Projects Dept # Added\GG001128 - 4137 M:\Blah Blah\Blahty\Blah Blah\Projects Dept # Added\GG004057 - 4137 M:\Blah Blah\Blahty\Blah Blah\Projects Dept # Added\GG001242 - 7567 M:\Blah Blah\Blahty\Blah Blah\Projects Dept # Added\GG001732 - 4166X M:\Blah Blah\Blahty\Blah Blah\Projects Dept # Added\GG001944 - 7005X M:\Blah Blah\Blahty\Blah Blah\Projects Dept # Added\GG001946 - 7005X Based on the last 4 or 5 characters of the folder name (if 5, will contain a trailing X), I need to relocate the folders to: M:\Blah Blah\Blahty\Blah Blah\CUMC\4137 - NBD Nobody Has A Clue M:\Blah Blah\Blahty\Blah Blah\CUMC\4166X - DER Dooby Doo M:\Blah Blah\Blahty\Blah Blah\CUMC\7567 - AAC Animal Care M:\Blah Blah\Blahty\Blah Blah\CUMC\7005X - ARK Noah Spent a couple hours googling to no joy, and have a deadline at work I have to meet, so I'll greatly appreciate any help provided. 0 Hi, I need a FOR command that will list the following list with ' as a delimiter. SET List=a'b'c FOR ... Expected output a b c Thanks for your help, Rene 0 Hello, In the past, I have been able to store a user's username, password and server in "Manage Credentials" under User Accounts in the Control Panel. Then when I run a simple batch file to map the network drives to the server, the batch file completes perfectly. I have tried exactly the same procedure but the batch file is asking me for user's username. Why isn't the batch file recognizing the stored Windows credentials and completing the map drives command? 0 I have a batch file that installs two fonts for all users when they login that I can't get to execute using the reg key: HKLM Software\Microsoft\Windows\CurrentVersion\RunOnce value: cmd.exe value type: REG_SZ value data: \\path\to\batch_file.bat The batch file works fine run on it's own. It's just the sending to all users I'm having an issue with. I also tried the "immediate task" method with no results as well in this article: https://serverfault.com/questions/442842/using-a-gpo-to-run-a-batch-file-once 0 Hello - I am looking to deploy a application within SCCM 2012 and the application is a .exe and vendor says it doesn't have any installers to accommodate any management installation platforms. I'd like to know how I can use a batch file to run exe and silently without any user interaction. I can push out from SCCM and place package in Software Center to be deployed , however there is a popup that needs software license agreement to be checked. I do not want users to have to do this and I want it silently installed. Is there any way to accomplish this with .exe? Thanks, nimdatx 0 Hi experts, Have a schedule job which I would like to execute at 2am with crontab expression (command). Question is How can I write it to execute only once please? I know it defeats the purpose, but how to come up with the cmd pls Eg. If I schedule it for tomorrow 2am, it should execute at 2 and it should never re-execute Thanks in advance 0 Hello All, Below script works fine and gets the output, I am planing to run this script against 50 Machines the output should have hostname/computername column. Thanks for help Import-module servermanager ; Get-WindowsFeature | where-object {$_.Installed -eq \$True} | Select-Object name, d
isplayname, installstate

0
I have a exclude file for my command it looks like this:
Z:\folder1b\file1.cfg


I have it like that to stop these two seperate CFG files from merging, ect.
Problem is, it seems to copy it regardless. I've even tried quotes.
Thanks.
0
Hello

I need help in developing a DOS batch script that will retry the job again if it fails, it should retry up to 5 times, before an actual alert message is written to a log file

Thanks
0
HI,

I need to create a batch file to do four specific things:
1) Open cmd prompt
2) Change directory to C:\Utility
3) Run a CPAU command
4) close the cmd prompt window when complete

Currently I have a batch file with these commands to get started:

open cmd.exe
cd C:\Utility

but cmd prompt just flashes up for a second and disappears.

Thank you
0
Hi My Fellow Scripting Peeps whom I admire because you guys know your Sh1t =)

I would like to have a simple script that i can run every time i need to help friends & colleagues
to backup their data before attempting repairs or formatting.

My reason for a progress bar or progress percentage is so that I have more or less an idea
of how long the process will take or how long before it is finished.

oh by the way... This will be my very first run with robocopy but i have used xcopy and xxcopy in the past.

XXCOPY has a dim future and XCOPY is not as robust as robustcopy(robocopy)

I hope i got all the info you need.
0
I had this question after viewing I need a batch file to search and delete registry subkeys.

How can I delete all keys under HKCU\Software\Microsoft\Internet Explorer\MenuExt that contain a given word in the key name?
0
This is my command line:
@echo off
FOR %%f IN (P*) DO type %%f >> combiness.txt & echo. >> combiness.txt

To put all files starting with P in a combiness.txt file, it worked on my old computer but i recently got a new one and its not working like I had hoped.
0
I have a user who puts the date he wants me to change the to reflect the update in the file name.

Example:  BMS Update 7.21.2017.xlsx

Is there a way to capture this Date in the file name so I can use it in my batch routine?  Maybe like store it in a set variable so I can use it in my batch file.       Set FileDate=FileDate

I cant use file modify date because the modify date and the date in the file name are different.
0
Hi Experts,

I have this script tested and works as expected.  script checks the disks attached to server and checks the  drive label  of the disks and create a .txt file with the drive letter name ( such as "D drive.txt")  scripts is copied to  each server already and locally run.

For an example, if four disk found as D, E,Y,S on a local server, after running the script,  when I  go into each disk, I should have a .txt file saved in there as D drive.txt, E drive.txt , Y drive.txt and S drive.txt

batch script will be used on  mixture Windows OS versions. ( 2003 to 2012)

Issue: it works fine when script is run locally but when needed to run using PSexec, it produces different issues  even though script is on the local server and all PSexec should do is executing the script with remotely instead of logging into the each server. I have read on forums that vmic is not very friendly with PSExec, is there way to eliminate wmic from the script? here is forum talks about the issues it causes:  https://forum.sysinternals.com/psexec-hangs-when-running-wmicexe_topic14752.html

markerfile.txt
0
hello

I want to reboot my client computer.
I want to give him time like 1 hour
but I want him to have a option he can restart before 1 hr whenever he wants.
0
I have created a Powershell Script and a Batch file.  I have placed the batch file in the startup directory of the machine.  It appears to run as I see the command prompt window on the screen with the message "Press any Key to continue".  If I press any key the command prompt goes away and the app I want removed (XBox) is still on the Tiles Page and works.   If I double click the script once logged in as any user it runs ... presents the same cmd prompt window with press any key to continue ... and removes the app.

I am hoping to fix two issues:

1) Remove the need to press any key to continue.  I want it to be invisible to the end users.

2) Get the script to delete the XBox app without having to wait until logged in and then manually clicking the batch file.

BATCH FILE:
@ECHO OFF
PowerShell.exe -ExecutionPolicy Bypass -Command "C:\scripts\RemoveW10Apps.ps1"
PAUSE

PS Script:
Get-AppxPackage Microsoft.XboxApp | Remove-AppxPackage

0
This is about the Acronis Backup & Recovery 11. We found that one of the service - Acronis Managed Machine service (mms) sometimes shows "stopping" while kicks start the scheduled backup job. When this service in this state, the only way we can do is to system reboot the server so as the service will be back to normal started state. We did use process explorer to "kill" the mms, however, we still can't manually start the backup job.

Out of no way, we are using the task scheduler to schedule to stop and start 5 Acronis services. Basically are those net stop/net start commands with 30 seconds interval as attached. The sequences are, net stop all the services in this orderly - Acronis Managed Machine service > Acronis Remote Agent > Acronis removable storage management > Acronis Scheduler2 > Acronis VSS Provider; and then net start same services in reverse order.

However, still, the Acronis Managed Machine service shows "stopping" upon the schedule restart. Is there a way that stop this service forcibly? As long as this service is stop, and then re-start shouldn't be a problem.

Thanks,
RestartAcronisServices.JPG
0
Every month I have to go through several text files after paying bills online to send to the CFO to show all the bills that have been paid. I have tried to get him to accept a print of confirmation page but instead he wants it in the format of file 2 below (ee-online-pmts-result.txt). So I copy the results from the web page, past it to a text file and then clean it up removing all the "junk" not needed. As such is there a way I can read the first text file (ee-online-pmts.txt) and then have a list of variables to parse that if found would be removed in such a way that the result will be what the 2nd text file looks like? For instance if  "Print this activity" and two carriage returns (enter, enter) are found it will remove it? Thanks!
ee-online-pmts.txt
ee-online-pmts-result.txt
0
Hello folks,
I need to create a shortcut by using a script batch or PS1 or vbs, I have found this for now but it will not give me a ie
icon

does anybody has a better solution ?
0

# Windows Batch

11K

Solutions

11K

Contributors

Batch files are text files containing a script of commands that are executed by the command interpreter on DOS, OS/2 and Windows systems. Most commonly, they are used to perform a series of functions that are repeated -- copying a set of files created daily with one step, for example.