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.

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)?


I am trying to create a batch file in windows 10 that would delete all files & folders from a specific folder and its sub-folders that there modified date is prior 5/23/2019.  I have used DateModified:<5/23/2019, then highlight them, then delete them, but for some reason next time run DateModified:<5/23/2019
 to make sure all prior 5/23/2019 has been deleted, more are displayed.  Also tried placing *.* then sorting by date but since so many files, takes super long but also after deleting, I search again,more files prior 5/23/2019.  I also tried ForFiles but also, no success.

Running MySQL 5.7 on Windows 7 Pro.

I have searched Experts Exchange before posting this question. I cannot find a suitable answer.

My question:  
I want to automatically backup my Mysql database using  a command line so it can occur automatically.
I want to add the date and time to the dump file name.  For example:
c:\Program Files\MySql\MySql Server 5.7\bin>mysqldump -u root -ppassword –databases dbname > mysqlbkup13-June2019_02:00.sql

The date should be in dd-mmm-yyyy format.  The time should be in 24 hour format.
I am not a DOS expert so I don’t know how to convince DOS to add the date and time to the output file name.  

Could someone please tell me how to do this?
I am tried to copy folder structure from folder a to folder b exlcuding all files.
I don't understand why files are copied with the following command:
robocopy folder a folder b /e xf *.*

Open in new window

Thank you

What is the best way to deploy PowerPoint template throw GPO for whole domain users.

I have 3 files for use :

the cmd file containe:

@ECHO off
SET TSManager=TSManager.exe

IF "%ERRORLEVEL%"=="0" GOTO TaskSequenceDeployment

MSIEXEC /I "%~dps0PowerPointTemplate.msi" /L*v "%temp%\PowerPointTemplate_1.0.0_Eng.log" ALLUSERS=1 REBOOT=ReallySuppress /qb-!
SET RETURNCODE=%errorlevel%

MSIEXEC /I "%~dps0PowerPointTemplate.msi" /L*v "%temp%\PowerPointTemplate_1.0.0_Eng.log" ALLUSERS=1 REBOOT=ReallySuppress /qn
SET RETURNCODE=%errorlevel%

I have two large batches of programs - several years work - in QuickBasic and Fortran IV .
I need to update these to a more modern language (Python?).
Are there any automatic translators?
where would I find them?
Is there a Dir command line option to search for a file or folder under a directory but exclude a specific subfolder in the search? dir /b /s ??
Dear Sir,

I am writing a script to ping multiple computer (hostname) at Dos prompt. A text file which contains multiple hostname. I would like to redirect the result to a text file and named using date and time.

Please advise. Thank you.

With regards,

I need to create a parameterized dos script then call it through a function.

So the string is :
&execString = "E:\NC_SCRIPTS\GeneralInvoice\GeneralInvoiceRPT.bat " | &RnCntrolID | " ";

I need to express the variable in here so it picks up the value correctly and not as a string.  
Are the quotes correct around my expression above?

Thanks, Brock
Need assistance with using ROBOCOPY on Windows Server 2016 Datacenter. In the past, prior to Server 2003, the /mov or /move switch would simply move the data, including files and folders inside a directory to another directory specified in the command. However, now it deletes the source directory after executing the move, see the command below:

ROBOCOPY "C:\(path)\Upload" "F:\(path)\Upload_Completed" /MOV /E /NP /LOG+:"C:\Scripts\movelog.LOG"

The "Upload" directory is deleted once the command completes. I DO NOT want the "Upload" directory deleted. I ONLY want to move the files and folders to the "Upload_Completed" directory. Is there a better way to achieve this goal. Please advise. Thank you.
Need CMD command for tasklist to sort Mem Usage in descending order?
I need to verify if a drive exist prior opening a windows apps.  I was thinking maybe using command prompt batch or powershell batch file to do this.  I want to have that code verify if drive J exist and if so, execute the windows apps.  If doesn't exist, then exit the routing messaging "Drive has to exsist".  How can I do this?
I am creating a batch file to automate certain tasks along new PC deployments.

I have a custom power profile exported for my Dell machines. The file name is powerplan.pow

When I execute the command: powercfg -import "powerplan.pow" it returns

"Imported Power Scheme Successfully. GUID: 5c534448-baa1-47f2-8838-a83d7ef6928d.

The next line in the batch file would be: powercfg -setactive 5c534448-baa1-47f2-8838-a83d7ef6928d

How can I grab the GUID value returned from the "powercfg -import 'powerplan.pow'" command and append it to the powercfg -setactive <GUID value>" command?
I have a  1 line batch command file(tbd.bat). In the batch file there is a line which is used to set/ create a time stamp.  When I run this batch file on Windows server 2012 the batch file works perfectly. However if I run it on my local PC, it isn't working. instead it just echoes the command to the screen.  Does anyone have any idea why it won't run on my local pc, and only on the server? I have also tried it from another local PC, and again it only echoes the command

tbd.bat :
set timestamp=%datetime:~0,8%_%datetime:~8,4%

On windows server 2012 the output from running the batch  is : set timestamp=20190212_1201

On my local PC the output of running the batch  is : set timestamp=~0,8datetime:~8:4

Please find the MS Dos command below. I am trying password protect a file. I am looking for a MS Dos command to do this (I need to include this command in a bat file)

@echo off
attrib +r -a -s -h "C:\Rep\MonthlyReports\abcd.xlsx"

Please let me know.

Thank you

I am trying to find out Dos Command to create bat file to delete a particular excel file (aaaa.xlsx) from a folder which has got many files in it.

thank you
On my Win 7 Pro machine I created a .bat file to xcopy my important data to an external drive.  It’s very simple.  It’s named ‘BackupWin74ToK.bat’ and looks like this.
md k:\Mike
md k:\Downloads
xcopy "C:\Users\Mike74\Documents\Outlook Files\Verizon.pst"   "K:\Mike\" /s /y /f
xcopy "C:\Users\Mike74\Documents\Outlook Files\archive.pst"   "K:\Mike\" /s /y /f
xcopy "I:\My Documents\Access_Databases\DevFolder\*.*" "K:\Mike\ DevFolder \" /s /y /f

Open in new window

‘DevFolder’ has all of my client development work

When I execute this .bat file, it starts out fine.
Copies the first two files then starts copying everything in the \DevFolder

The issues is that at some point in the xcopy the process terminates without finishing and deletes file 'BackupWin74ToK'.  I need to resolve why it’s not finishing and why it is deleting file ‘BackupWin74ToK.bat’ when it terminates

1.      I’ve watched the screen as the xcopy execute.  It lists each files its copying in the command window while executing but I can’t pin down what is causing the failure.
Is there some way I can have the bat file create a hard copy trace of each files it copies so I can identify where it is cancelling?

2.      The surprising thing is that when it terminates the bat file is also gone from the drive.  It disappears.  I can’t even imagine why this is happening but it must have something to do with what is causing the cancellation.  Any ideas why the bat file disappears.
I have approx 2,000 text files in this format:


lines 5 and 6 are coordinates.  I nned to add 0.375 to line 5 and subtract 0.375 from line 6 for all 2,000 files.

Please find below DOS script.

@echo off

echo Start Copy

set SOURCE_DIR=C:\aa\bb\cc
set DEST_DIRS="Y:\dd\"
set FILENAMES_TO_COPY="2010&2018 Rprt.xlsx"

pushd "%SOURCE_DIR%"

for %%F in (%FILENAMES_TO_COPY%) do (

    for %%D in (%DEST_DIRS%) do (
        echo file "%%~F" to "%%~D"
        xcopy /Y "%%~F" "%%~D"



echo. Done.
exit /b

Open in new window

Because of the "&" in the file name(2010&2018 Rprt.xlsx), the file is not getting transferred into the destination folder. I need to keep the file name as it is.

Please have a look
Thank you
I have directory structure similar to this


xxxxx is a unique number to each folder/listing

Its on a windows server, I need to change all of the files to something else, but do it recursively, so that it will do it in all the folders within the /images/ folder

So something like this
would get changed to /images/widgets/widget/11111/11111-RENAME.pdf

would get changed to /images/widgets/widget/22222/22222-RENAME.pdf

would get changed to /images/widgets/widget/33333/33333-RENAME.pdf

and so on.  I know how to do the ren command random characters etc *-LFS.PDF

But not sure how to tell it to do all the directorys?
I'm working with several systems, all Win 10 1709 all have same image.  On one of them netdom works wonderfully, on the other two I'm working with running netdom returns " ' netdom is not recognized as an internal or external command, operable program or batch file"  Searching for "netdom" returns no results.  Why would it be working on some machines, but not others?
Hello Experts, I have almost zero knowledge of batch file syntax. I have a batch file that works. It is executed via a Windows Scheduled task which is called from SSIS. The syntax has date parameters that are currently hard-coded. How can I pass those two parameters to the batch file.

The parameters in the stript below are: -beg-obs 2017-01-01     and -end-obs 2017-12-31

grpr -new-amf-file "E:\Risk Grouper\Output\20190123Medicaid.amd" -patient "E:\Risk Grouper\Extracts\PatientExportMHACO.txt" -patient-format "E:\Risk Grouper\AMF\PATIENT.amf" -medical "E:\Risk Grouper\Extracts\MedicalExportMHACO.txt" -medical-format "E:\RISK Grouper\ACGF\MEDICAL.amf" -pharmacy "E:\RISK Grouper\Extracts\PharmacyExportMHACO.txt" -pharmacy-format "E:\Risk Grouper\AMF\PHARMACY.amf" -RAV US-ALLAGE -all-models -beg-obs 2017-01-01 -end-obs 2017-12-31 -filter-obs -calc-cost-obs

SSIS is running off of one server and the application that the above code is executing is on another server. Both are Windows Server 2012

Any insight is appreciated.
Thank you

It would be great if you could convert below MS Access VBA scripts to a ms dos commands (so that I can create bat file to do the same job)

Public Sub SetAttribNormal()
SetAttr "X:\Report_New.xlsx", vbNormal
SetAttr "N:\Report_New.xlsx", vbNormal
SetAttr "X:\AA\Projects_New.xlsx", vbNormal
End Sub

Public Sub SetAttribReadOnly()
SetAttr "X:\Report_New.xlsx", vbReadOnly
SetAttr "N:\Report_New.xlsx", vbReadOnly
SetAttr "X:\AA\Projects_New.xlsx", vbReadOnly
End Sub

Thank you
Hello Expert's,
Need a batch scripts:-

We have an application which is generated a log file in txt format (d:/OF Top/logs.txt), once application generate new log that happen added to that txt file. It happens so often, txt file have info in the term's of user identity number.
e. g.
11345, TOP, BLACK, TOPIC11, 110067145, DBEN, EXCEL, 11:33:54, LOCK
11345, TOP, BLACK, TOPIC81, 110067155, DBEN, EXCEL, 11:33:54, LOCK
11345, TOP, BLACK, LOGIC00, 110067145, DBEN, EXCEL, 11:33:54, LOCK
11345, TOP, BLACK, MAGIC99, 110067105, DBEN, EXCEL, 11:33:54, LOCK
11345, TOP, BLACK, TOPIC89, 110067110, DBEN, EXCEL, 11:33:54, LOCK
11345, TOP, BLACK, ARPIT67, 110067100, DBEN, EXCEL, 11:33:54, LOCK
11345, TOP, BLACK, MANIS56, 110067110, DBEN, EXCEL, 11:33:54, LOCK
11345, TOP, BLACK, WHITE00, 110067145, DBEN, EXCEL, 11:33:54, LOCK
11345, TOP, BLACK, ACERP23, 110067155, DBEN, EXCEL, 11:33:54, LOCK
11345, TOP, BLACK, TOPIC89, 110067105, DBEN, EXCEL, 11:33:54, LOCK

Column number 5 have user Identification numbers.

There are many such lines store in this file.

Now i want a batch when I run the batch file then batch ask me to place user identity number to grep that particular user identity number and generate a txt file in a prefix location (c:/out. txt)

after that once new entry came to this file it will automatically grep that entry & store (add) in to out.txt file.
How to copy files with creating new folder from dos prompt without prompting the (F = file, D = directory)? F, I want to copy the files and if destination subfolder does not exists then automatically create one.

Xcopy C:\test\test.txt d:\test\test.txt
Xcopy C:\test\1\test.txt d:\test\1\test.txt
Xcopy C:\test\1\2\test.txt d:\test\1\2\test.txt

(F = file, D = directory)? F

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.

Top Experts In
Microsoft DOS