We help IT Professionals succeed at work.

Microsoft DOS





Microsoft Disk Operating System (MS-DOS) was an operating system for x86-based personal computers, and traces of it are still found in the Windows operating system. DOS is still used in some embedded systems and for certain legacy 16-bit networks.

Hi all,

I created a batch script and was wondering if someone could let me know if there are any syntax errors before I deploy this out.   Currently we have a customer that needs to have a directory purged nightly.   Reason is when the come in the next day their application still shows previous days data which mixes up with their current data the next day.   Here is the batch script I wrote.  Appreciate the help as always.

echo deleting file

del "D:\CZM-HFA2i\EM\Data_Export\Processed *.*" /s /f /q
del "D:\CZM-HFA2i\NM\Data_Export\Processed *.*" /s /f /q
del "D:\CZM-HFA2i\OP\Data_Export\Processed *.*" /s /f /q
del "D:\CZM-HFA2i\WM\Data_Export\Processed *.*" /s /f /q

echo Done!
Trying without success to create a bat file to copy a file creating a backuip version.

 If possible I'd like the copy of the file created with the data and time stamp at the time of creation.

For example: Original File name 'GRBDQDb01_2013.accdb'  Copied file name 'GRBDQDb01_2013_20200221_1100.accdb'

If that isn't possible I'd like the copied file to create anew version rather than overwrite an existing file of the same name.

For example: Original File name 'GRBDQDb01_2013.accdb'  Copied file name 'GRBDQDb01_2013_X.accdb', where X is the number of version that exist.

The file I want to copy is named 'GRBDQDb01_2013.accdb'.

It is in directory 'I:\My Documents\Access_Databases\GRBLaw\GRBDelinq'

This is what I have so far but it doesn't copy the file, let alone stamp it with the data and time or create anew version.

cd I:\My Documents\Access_Databases\GRBLaw\GRBDelinq
copy I:\My Documents\Access_Databases\GRBLaw\GRBDelinq\GRBDQDb01_2013.accdb I:\My Documents\Access_Databases\GRBLaw\GRBDelinq\GRBDQDb01_2013_PreCompress.accdb 

Open in new window

I have to add additinal logic to ensure the process is not running:

Current Code that works.  But need to add logic where file ' %TRIGGER_DIR%\%RUNNING%.trig' doesn't exist......

if exist %TRIGGER_DIR%\%JOB_NAME%.trig (
 call :RUNJOB
  ) else (
  call :QUIT
exit 0


Open in new window

How can this script be altered to EXCLUDE a set of words like "the", to", "and", "from", "for" from the capitalization:

I quickly solved the retyping problem:
+^k:: ; SHIFT+CTRL+K converts text to capitalized
  Clipboard := ""
  SendInput, ^c ;copies selected text
  StringUpper Clipboard, Clipboard, T ; Title mode conversion
  SendInput %Clipboard%


Can you please find a script or commands that can do the following in "Power Shell or DOS".  
I want to get a list of folder and file size that are within the "Accounting Users" folder.
This is on a Windows 2008 server.
I have a batch file that runs a process, updated some report and then generates an email in outlook to notify the users the reports have been updated. How do I get this to also include a link for the users to click on that would launch the excel file that is sitting in a static directory?
Windows 10

I have many files "Invoice.201911100930.txt", which is "Invoice.(datetime-stamp).txt.  I want to eliminate "." after "Invoice", so it should be "Invoice201911100930.txt" using command prompt. Would you tell me how to?

Thank you in advance.
I have a large directory with over 10,000 files... the are in a common file naming convention of:

[Last name], [firstname] [year]-[month] [characters]
EX Smith, J 2019-10 MMC

Wanted to display only the file names that do NOT have a space after the coma after the last name Ex "Smith,J 2019-10 MMC"

Is this possible and if so perhaps a view in Windows 10 File explorer.

Thank you.
Windows 10

We received EDI from partner. Its file name is "Invoice.201910180930". Basically "Invoice.(today's date) format". I need to make it TXT format to import it to our database. How can I rename it to "Invoice.201910180930.txt" using command prompt?

Thank you in advance.
Robocopy.  Is it possible to generate a report / log file that only shows the new folders created as part of a particular copy run?  The verbose log lists every folder and file touched and uses "new dir" to indicate a new folder, but given that this verbose log is >95,000 lines that can be cumbersome.

I'm attempting to remove a partition from a HDD so I only have 1 partition not  2  see pic
Using Xcopy I started to copy the data to another disk this run out of Memory so I'm now using FolderMatch

Xcopy cmd was something like

@ N:\
md Areeya (Drive name to be backed up)

cd Areeya

Xcopy E:\ /s

Open in new window

In widows Explorer I cannot see a folder "Areeya" unless I type "N:\Areeya" in the explorer bar
I can then see all subfolders

Example properties of a subfolder

in a CMD window I get  

File not found - N:\*.*

N:\>attrib Areeya
A  SH                N:\Areeya


Open in new window

I think that means A => Archive S=> System H=> Hidden ??

Any suggestions how to make this folder visible in Windows Explorer? I have Show Hidden files ticked!

I'm hopping once I've copied all the data over I can remove both partitions and convert it back to Basic

I can then copy the data back again
Hi Experts,

Not sure For /F is correct solution but I think it is.

Desired Result for the 'Result.bat' file:
My current For /F which is not working.  Never even makes it to the pause for some reason.

@echo off

set AppName=Fin

FOR /f "tokens=1 delims," %%G IN ("D:\Years.csv" DO @echo "call epmautomate exportData %AppName%_DATA_%%G %AppName%_LEV0_DATA_%%G.zip" > "D:\Result.txt"


exit /b

Open in new window

looking for replacement the old 32 bit TOUCH program to change by commandline the date for file   like it was in dos
its not running in 64 bit

touch j:\*,*   or touch j:\*.txt    will files selected to today date
I'm trying to create a batch file that will add the current date to a file. I found this online - but it only works when you enter it directly on the command line
for /f "tokens=1-5 delims=/ " %d in ("%date%") do rename "filename.pdf" filename_%g%e%f.pdf

If its in a bat file I receive this message
dategf.pdf was unexpected at this time.
screen shot of running commands
I'm looking for a solution and I'm not tied to this one if you have a better option.

Thank you!
Hello experts,

Please can you explain me exactly what this command does ?

/C copy /b Image1.jpg + Archive.rar Image2.jpg

Best regards

I'm looking to copy a folder from one location to another. The destination folder does not exist.

How can I do this with Xcopy?

The following will copy all folders within sourcefolder, to destination folder, but that's not what i want.

Xcopy /E /I   c:\temp\sourcefolder  T:\temp\destinationfolder\

I want to copy folder sourcefolder to a new folder within destination folder.

Any help much appreciated.


MS ref: https://support.microsoft.com/en-gb/help/289483/switches-that-you-can-use-with-xcopy-and-xcopy32-commands
Hi Experts,

This is in regards to the following question.


In addition, that script only works for IE, I would like to add check for Chrome, Safari and Firefox as well?

Whoever has an answer kindly post it here.

How do I control the information displayed in the dos window header?

If I run a batch file, it will display the name of the batch file in the header of the DOS window which it is running in. Also if I pass parameters to the batch file, it will display the name of the batch file followed by the parameters values passed. So how can I prevent batch file name and input parameter from being displayed in the header, when the batch file is running?
In the DOS command window, after my dos command or batch file has completed it's run, I would like for the dos window to close. Does anyone know if there is a command which will close the dos window after the command file has completed it's run?  You see I am not allowed to change the command file "mergeStrayFiles.cmd", so I cannot place a close dos window command inside of my .cmd file. So somehow dos needs to close the dos windows once the command file has completed running.

I have the following batch file now I want to add STEP 1 STEP 2 if STEP 1 FAILED then goto next step and send email or generate output in txt

powershell.exe -executionpolicy bypass -file J:\Backup\EnableTCP-IP_Named_Pipes.ps1
powershell.exe -executionpolicy bypass -file J:\Backup\Restart-SQL_Server.ps1
if errorlevel 1 echo Unsuccessful > J:\Backup\result.txt
if errorlevel 0 echo command executed successfully > J:\Backup\result.txt

Hi Experts,
I am looking for a program that will list all PC names, browser names and versions within the network.
Would prefer it to be done either as a DOS command, batch file or VBA.
Hi Experts,

How can I modify this DOS command to only look at files created after a certain date?

If I am in DOS, how do I find out specific documentation about a dos command? For example I want to find out about the dos command /k switch which can be used to prevent a dos window from closing when called from an application.
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
@echo off
cd c:\xxx\zzzz\yyyyyy\
move * Q:\test\--(note:this is the map drive letter for unc path)
sleep 5
del *

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

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


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

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

\SYSTEM32\cmd.exe" with return code 0.
I am running an SQLCMD command from DOS against a SQL Server 2008 database that occasionally outputs the following message at the end of the data:
"WARNING: Null value is eliminated by an aggregate or other SET operation."

I do not control the DB and do not want to fix the error, I just want to suppress the warning message.
I know the default ERRORLEVEL is 0.
If I add the output parameter -m1 this warning disappears.  This is what I want because the output is read by a different program and does not expect messages at the end.

But it raises a few other questions for me:
1.  What ERRORLEVEL values exist in SQL Server?
2.  Do they mean anything?
3.  Is there a maximum (if I want to suppress any/all errors)?


Microsoft DOS





Microsoft Disk Operating System (MS-DOS) was an operating system for x86-based personal computers, and traces of it are still found in the Windows operating system. DOS is still used in some embedded systems and for certain legacy 16-bit networks.