Windows Batch

12K

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.

Share tech news, updates, or what's on your mind.

Sign up to Post

I am looking for a .bat to .exe converter for Windows 10
Thanks,
0
Why Diversity in Tech Matters
LVL 19
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Hi

I have an ALL Staff Universal security group, which we use for sending email for ALL Staff.

Within this ALL Staff Universal security group, there are other departmental mail groups added as well. I would like to have the list of all users who are member of this ALL Staff Universal security group

Is there a way of exporting all the members to a notepad or excel.

Any help will be great.
1
Hello experts,

I have a file with multiple lines.

I am looking for an script or a regular expression to retain lines which start with the following string: 2019-11-21 and contains the following string : “loading file”

Thank you for your help.
0
Hi, I am trying to promote a Windows 2016 server (SERVER2) to a domain controller in MYDOMAIN from a windows server that is not part of that same domain. Then clean up the metadata left over from SERVER1 that is never coming back online. Then run dcdiag health checks against SERVER2 (now a domain controller in MYDOMAIN) and other already exsisting domain controllers in that same domain. I am not looking to build a script that needs no input. Someone will be providing account names and password for the admin account (member of enterprise administrators) used to authenticate to MYDOMAIN.

And thank you for any and all help from anyone offering, regardless if your suggestion is used or not. I appreciate it very much.

I can use powershell to load ADDS and promote the server I am logged onto to a domain controller, I am just hung up on how to do it remotely. There aren't any issues with running ntdsutil from a standalone server against domain controllers in MYDOAMIN, is there?
0
I have a VERY small batch file which was created a couple of years ago by an expert here on EE.  Now I need two very small and simple changes made to it (I am not a programmer, obviously). I just tried posting it to Fiverr, where I have an account, but their list-a-job is miserably lacking for such a thing.

SO...would any expert care to handle this for me? I have a strong feeling that this is a 5-minute or less task for anyone who knows .bat files.
0
Hello,

I need to make some registry changes using the below.  When I copy and paste the lines in a  CMD window run by administrator, I am getting syntax error.  

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverride /t REG_DWORD /d 0 /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverrideMask / t REG_DWORD /d 3 /f

Please advise.  

Thanks.
1
I would like to create a powershell script or batch file script that will run multiple software  one after on multiple  remote computers  and show progress bar while installing and creating log file.
How can I do that bt scripting
1
Hello Team
I like to have a batch  cmd file or powershell script to  copy folders (documents,downloads,desktop,favorites) from user that has old computer  with old computer name to user  that will have new computer  with another computer name  both computers have different computer names and connected to same network as I would like to run this  script on  new computer of user so  it has to ask for computer name so I write old computer name of user and then ask about user folder so I select user profile from c users folder and after it copies documents ,downloads,desktop ,favorites from old computer of user to new computer of the user as i would like to acheive that in powershell and batch cmd  that shows progress bar while copying and log file
0
I am trying to run .vbs script who reads data from Excel. It works fine when I run it from command line but it does not work if I run it from Task Scheduler, but if I run it as Administrators  from Task scheduler it works. But the I can only save the task as "Run only when user is logged on"

file
0
If I run the commands below the first one opens a notepad text file in a maximized notepad window. The second one opens the same file but the notepad window is minimized.
So I am wondering two things.

1. Is there a way to open the notepad window so that it is half or fractionally open? Like 1/2 the normal size.
2. Is there a way to specify the location of the notepad window when it initially opens? Like left of center?
    I ask this because I will open a two notepad windows and do not want them to all be in the same location/coords. I would prefer
    that the last window open is displayed slightly to the right of the first notepad text file displayed.



1. C:\cmd.exe /c start /max notepad.exe c:\mySampleFile.txt

1. C:\cmd.exe /c start /min notepad.exe c:\mySampleFile.txt
1
C++ 11 Fundamentals
LVL 19
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Hi Experts,

I've a batch script for pinging multipal ip's, now i want convert this batch script to C# Windows Forms App (.NET Framework) & run ping with start button.

Please Suggest ?
COLO.txt
COLOPINGLOOP.txt
0
I want to install from command line (script), and MSIE add-on, which is a cab file stored on internal web server.
The cab contains two files:
abwxprint.ocx
abwxprint.inf

The inf contains, that:
[version]
    signature="$CHICAGO$"
    AdvancedINF=2.0
[Add.Code]
    abwxprint.ocx=abwxprint.ocx
[abwxprint.ocx]
    file-win32-x86=thiscab
    clsid={226D14C3-DEA2-4F68-9CD3-3837439AF7DE}
    FileVersion=1,0,0,1
    RegisterServer=yes


I see on Internet, different solutions, but nothing works.
rundll32.exe advpack.dll,....
pkgmgr ...
I've tried to copy the two files, on "C:\Windows\Downloaded Program Files", to register the ocx with the regsvr32.exe command.
After that, the add-in is in the add-ins MSIE list, but is disabled.
I don't know how to enable it with command line?

My purpose is to automate the add-in installation, directly without GPO (I have another tool to teledistribute, an automate some actions).

Thank you for your help.

Jm
0
I need a custom script or batch written to check for the existence of two daily files that should exist for the next day. More specifically, we have a scheduler system that should be exporting a proprietary file for the next day. If this file does not get created then someone needs to be alerted prior to midnight when that file would need to be used. The scheduler is creating two files for each day so we would need to check for both. The format of the files is MEGA%MM%%DD% and BLAZE%MM%%DD%, where %MM% is the 2-digit month and %DD% is the 2-digit day of the month. Example of files: MEGA0913 and BLAZE0913. Neither file has a file extension so Windows just sees them as a type 'file'. I plan on using task scheduler to check for both files at 9pm of the day before. So on the 13th, the script would run at 9pm and be looking for MEGA0914 and BLAZE0914. Both files reside in the same folder. If either of the files is missing then the script needs to send an email, using BLAT or similar to alert an email address as to which file(s) are missing.
0
Hi,
I am trying to enable TCP/IP and Named Pipes using the following command. But I have encountered the error:--

WMIC /NAMESPACE:\\root\Microsoft\SqlServer\ComputerManagement10 PATH ServerNetworkProtocol Where ProtocolName=’Np’ CALL SetEnable

Please see the attachment.

Thanks
Capture.PNG
0
I have created batch job to copy a file to UNC path, which is mapped to my computer. The batch job run from task scheduler but the file doesn't transfer to UNC path. But if I run command manually is successfully copy files. I have tried both batch below:
####################################
  @echo off
pushd c:\xxx\zzzz\yyyyyy\
COPY * Q:\test\--(note:this is the map drive letter for unc path)
Sleep 5
popd
end
cls
################################################
@echo off
cd c:\xxx\zzzz\yyyyyy\
move * Q:\test\--(note:this is the map drive letter for unc path)
sleep 5
del *
#end
exit



Action Started
Task Scheduler launched action "C:\Windows\SYSTEM32\cmd.exe" in

instance "{90e9b280-15df-4a79-9ec1-6bef9a621423}" of task

"\xxxxxx".

Action completed
Task Scheduler successfully completed task "\xxxxxx" , instance

"{90e9b280-15df-4a79-9ec1-6bef9a621423}" , action "C:\Windows

\SYSTEM32\cmd.exe" with return code 0.
0
Dear All

 
               How do i remove reg key without asking yes or no ? i have put /f at the back of the command but doesnt look like correct, i want to create a login bat to GPO, any help would be appreicated

1
0
Hi all,

First of all I'm don't know a lot about scripting and that's the reason I'm here requesting some assistance. So here I go:

We do have a GPO that runs a logon script (batch file that then runs a PS1). The whole purpose is to create shortcuts on the folder redirected desktop of such users (on a Citrix server environment) if they belong to those groups.
The problem we are facing is that sometimes the shortcut will not get created. Based on troubleshooting it seems this script is not the most efficient way to accomplish this task and basically the reason why it doesn't get created is because it times-out. Every day we get calls that the shortcut was not created and most of the time running a GPUPDATE or login the user off/on corrects the problem.

So here I'm asking is a better way to accomplish this task? Please let me know.

REM ---------------
REM -Version Check-
REM ---------------
echo f |XCOPY "\\company-file1\apps\ClientApp\CA\rtclient.exe" "%appdata%\Clientapp\CA\caclient.exe" /D /y /f /e
echo f |XCOPY "\\company-file1\apps\ClientApp\CA\ClientAppUpgradeFix.bat" "%appdata%\ClientApp\CA\ClientAppUpgradeFix.bat" /D /y /f /e
REM -------------------
REM -End Version Check-
REM -------------------

Powershell.exe -executionpolicy remotesigned -file \\company.corp\SysVol\company.corp\Policies\{F144FEB7-BEEA-49C8-B421-3A0F1A089776}\User\Scripts\Logon\UserValidate-Profile.ps1


It then runs that PS1 powershell

Import-Module ActiveDirectory
0
I had this question after viewing batch file to add map driver for network location and ask for credential.

I have two "DC" and now I'm trying to create a batch or shortcut to DC2  to be map to other folders.
net.exe use X: \\APPS \PCC storage * /user:DC2\myname /persistent:no
Is this fine
or another below statement..

@echo off
if Not exist y:\ (

echo Please enter User ID:
set /p USERID=

echo Please enter your Password:
set /p PASSWORD=


cmdkey.exe /add:APPS.US /user:dc2\myname /pass:%PASSWORD%


net use O: "\\APPS\PC1 storage" /persistent:YES
pause
)
1
I have few OS commands which I need to run only through ADMINISTRATOR's CMD console
please advice how to call such batch script

example :TEST.BAT
how to make sure below  script called from admin cmd console
==

echo " Hello"

==
0
Become a Microsoft Certified Solutions Expert
LVL 19
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Dear All


             i have made below bat file to client desktop, and found that 1 computer showing the wrong ip address after click on the bat file, the ip show the old DC & DNS server, any idea what goes wrong ? any idea to get it fix and showing the real computer ip address ?


@echo off
REM myip.bat
REM script to return just the IP address of the current host.
REM Works on Windows 2000 / Windows XP
COLOR 4f
REM TYPE "FOR /?" AT THE COMMAND PROMPT TO GET DETAILS REGARDING THIS COMMAND LINE.
REM NOTE THE SINGLE BACK QUOTES ARE THE ONES BELOW THE ~ KEY ON THE KEYBOARD.
FOR /F "usebackq tokens=2 delims= " %%i in (`nslookup %computername%`) do set myip=%%i
ECHO.
Echo IP Finder
ECHO -----------------------------------

ECHO My IP Address Is: %MYIP%
Echo.
ECHO My Computer Name Is: %COMPUTERNAME% 
ECHO -----------------------------------
@pause

Open in new window

Keith
0
I am wondering if it is possible to change a line in an ini file using a batch script to a specific directory on a drive
0
Hello,
when a batch-file is executed in cmd. I want to make sure that exactly one parameter has been passed.
How can I do this?
0
I want to install the SCCM agent on a list of computers listed in the text file  c:\temp\list.txt from my computer using the command below.

PSEXEC @”:C\temp\list.txt” –d –h –s –c  “C:\temp\sccmclient.bat”

The sccmclient.bat should do the following
Run this command
CCMSETEP.EXE SMSSITECODE=ABC

The ccmsetup.exe is in a shared folder on \\fileserver1\share1\ccmsetup.exe

I want to run this command with elevated privileges so want to include username and password in the above PSEXEC command.
I tried it with quotes, without quotes but looks simple but this thing does not work.
Appreciate some help
0
I am trying to run procedure in cshtml and want to run one procedure automatically.  Dont want to use windows service or batch file as it is not really working.

i am using something like this in the batch file which runs every hour
start "<C:\Program Files\Internet Explorer\iexplore.exe>" http://10.180.8.5:9093/Feature/DownloadFeatures 

at one point it says completed successfully but it is not doing anything ie. not running the downloadfeatures method. Can you please help? Any automated tool i need to use to run this cshtml file?
0
I have a scheduled task that runs a batch file.  The batch file has several lines where I do a "git pull" command from a specific Git repository.  The Windows server where this runs has already been configured with proxy settings so that when you run "git pull" or any "git" command, it will properly connect to the required repository and run the command.  I have figured out that this schedule task and batch file will run just fine when a user is logged on.  But if I log out of the server, the schedule task start, but the "git pull" command gets stuck.  It's almost like it's can't connect and then the rest of the batch file will not run.  What should I do to ensure the "git" commands run fine even when a user is not logged in?

Thanks in advance!
-Christian
0

Windows Batch

12K

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.