Microsoft DOS

13K

Solutions

12K

Contributors

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.

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

Sign up to Post

I am attempting to write an automated uninstall string, same app, multiple versions. I would have preferred to do this via PowerShell but apparently their servers are so old only some of them support it. So I have found a command line way to find the uninstall strings from the registry, but I am not sure how to pass the string to an execute inside of a batch.

reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /s /f "OpenSSL" | findstr /B ".*UninstallString"
reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" /s /f "OpenSSL" | findstr /B ".*UninstallString"
0
Cloud Class® Course: Microsoft Exchange Server
LVL 12
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

When I run this statement, I get an error that says "%%G was unexpected at this time":
for /F "tokens=2 delims==" %%G in ('WMIC /NODE:"myserver" Service WHERE "Name = 'myservice'" GET State/value') do set CURSVCSTATE=%%G

But, when I run just the WMIC statement, it works fine:
WMIC /NODE:"myserver" Service WHERE "Name = 'myservice'" GET State/value

I'm pretty sure it has to do with the single quote terminating the WMIC command to early, but I can't figure out how to fix it!
0
I have a windows batch file with echo off that gets user input using the SET /P statement like this:
SET /P UserAnswer=What is your answer?

I am calling this batch file with another batch file (CallerBatch.bat) using the "CALL" command and I'm using the > character to redirect the output to a file, like this:
CALL "MyBatch.bat" >MyOutput.txt

The problem is that when I run CallerBatch.bat, I never see the "What is your answer?" appear, even though the system is waiting for the user input.

How can I set it up so that this can happen?
0
Hi,
I want to ensure all output of dir, would go into t3 file. What to adjust below?
dir c:\peter\*.*/s >> c:\ed\t3.txt
dir c:\may\*.*/s >> c:\ed\t3.txt

Open in new window

0
Can anyone advise me if the script below deletes 30 days after the subfolder amended OR 30 days after it created.

What I need it to do is delete 30 days after the subfolder was created and not 30 days after last opened or amended.

@echo off
set dump_path=S:\DOWNLOADS
set max_days=30
forfiles -p %dump_path% -m *.* -d -%max_days% -c "cmd  /c del /q @path"
forfiles -p %dump_path% -d -%max_days% -c "cmd /c IF @isdir == TRUE rd /S /Q @path"

Open in new window

Thanks
0
Hi Experts,

I have a .bat file that is used to backup data.  I want to include all folders / files on a drive but exclude one folder.  I can't seem to get it to do the exclusion.

Here is the WinZip Command Line.

"C:\Program Files\WINZIP\WZZIP.EXE"  -xd\\PL1\PL1-G-Data\Photos\*.*   "Z:\PATLAPTOP1\PL1-G-Data\%date%\PL1-G PatData All.ZIP" "\\PL1\PL1-G-PatData\*.*"  -r -p

Explanation
- Job is run on the PC where the 'Z:' Drive is located.
- Drive to be zipped is on PC \\PL1.
-  The Drive to be zipped is PL1-G-PatData.
- Folder (with sub folders) that needs to be excluded is PL1-G-Data\Photos

What needs to be done to get it exclude the PL1-G-Data\Photos folder.  Right now there are no errors but it is including the Photos folder?

Note: If using an 'Exclusion Parameter File' is a better way them I ok with it.

Thanks,
Bob C.
0
Hello experts,
I am looking for two batches that
1-delete /f based on a csv file.
2-rmdir /q /s based on a csv file.

-Full path of files to delete and remove directory will be reported in column a
-Two different batches or CMD and CSV files one for rmdir.csv and the other del.csv.

Logs files should be generated in order to check what has been removed.
Rmdir just remove reported folder and not parent folder.
/S option should be set up to remove subdirectories of reported folders.
 If you have questions please contact me.
0
I have a  script that merges files into a subfolder and then asks me if a chiltern or BTP download and depending on if I push Y or N depends on what happens.

This is fine but what im trying to do is when I push "N" for both of them I need the folder moved to "E" drive so I can burn to disk .

Everything is OK apart from the last bit where I instruct it to move to "E" drive.   Whats happening is that it moving the folder but not appearing in "E" drive where you normally drag folders over to before burning.

What it is if I select "N" for both  BTP and CHILTERN I need it moved to "E" drive where you drag folders before burning and then all I go to do is click on "BURN TO DISK".

Any Ideas?

echo off
setlocal EnableDelayedExpansion

rem Define folder paths
set BaseDir=X:\DOWNLOADS
set DestDir1=X:\BTP DOWNLOADS
set DestDir2=X:\CHILTERNDOWNLOADS

rem Quit if no files in download area to process
set Empty=Y
for %%A in ("%BaseDir%\*.*") do set Empty=N
if "%Empty%" EQU "Y" (
    echo No new files to process, quitting.
    exit /b
)

rem Prompt for reference number
set RefNum=
set /P "RefNum=Enter reference number (blank to exit):"

rem If none entered, exit script
if "%RefNum%" EQU "" exit /b

rem Make a subfolder for the reference number
md "%BaseDir%\%RefNum%"

rem Move all files to new subfolder
move "%BaseDir%\*.*" "%BaseDir%\%RefNum%"

rem Ask if BTS download to determine where to move the new folder
choice /C YN /M "Is this a BTP download (Y/N)?"
if 

Open in new window

0
Dear all
We received xml documents from our partner that could be easily be opened manually with excel document. With output  format xlsx

We are looking for DOS or powershell based script that we can used to automate the conversion.

Any ideas how the script might look like. or some tutorials, that could help us solve this issue?
0
My co-worker working on an old app and he need to make some updates to a DOS app. I haven't work with DOS in years and to avoid the learning curve I was hoping someone can assist. I need to setup a variable in DOS and looking to get some help on setting that up.  Any help would be greatly appreciated.
1
Cloud Class® Course: Microsoft Azure 2017
LVL 12
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Trying to run

        Dim RetVal As Long
        RetVal = Shell("for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO @if exist %%i: dir %%i:\*.* /s /b >E:\zzz\Zip-Bak\DayBkUp\DirectoryListHistory\%%i.txt")



Get error run time error 53 file not found?

It runs fine in a dos batch file

Trying to create a series of text files with a list of all files on each drive on my computer

Thanks
DIR-ALL-Drives.txt
0
I had this question after viewing Printing on Network Dot Matrix Printer from MS Dos based program in XP.

What if LPT1 is already disabled from device manager, and still we are not able to give print from dos on dot matrix printer on network.
0
I had this question after viewing batch findtext match 2 criteria.
i am still playing with the above, however now i am having an issue while searching a csv i need to look for "DS" & "DSA" including the ", is there a way to accomplish this using findstr
perhaps with a double "
/c:"""ds"""

Open in new window

0
Dear Experts

Please can someone assist me. I would like to run a batch file on remote machines as an administrator. The batch file is located on a share that is accessible to everyone.

I am  trying to use psexec.

I am trying this but it doesnt seem to be working:

PS C:\Users\navishkars\Desktop\PSTools> .\PsExec.exe \\agent47-pc -u mydomain\admin-navishkars -p password cmd "\\dbnfiles\Software\DB2-ODBCClient\1_clidrivercopyandinstall.bat"
0
I am trying to take an input string, extract the second through ninth character and use it as a directory name.  This is real DOS I'm talking about, not a shell in Windows. This is real boot up to a C:\ prompt DOS from a Windows 98 boot disc.  Windows is non-existent on this system.

I tried:

set test=123456789012
echo %test:~1,9%

Open in new window


But it just returns "ECHO is on"

I want to see 23456789, so I can then use it to create a directory named 23456789.

The end goal here is to create a batch file which I can launch with the string as an argument.  Then I would create a directory and take the results of the batch file and copy them into that directory.  Every time I run this particular test, it will overwrite the results, so I need to move them into a meaningful directory name each time.
0
Hello Experts,
I am trying to run a set of DOS commands from C# program, which need to be executed in a Windows Service.  It runs fine in Development machine and Test Server.  But when I deploy that in Production, it does not run.  When I say it does not run, only DOS portion does run.  The C# part runs just fine.  Any idea, what is going on?  Is there a way I can capture any exception?  Any help is highly appreciated.

Thank you very much in advance.
0
Hello Experts,

Using this batch how to print %sum1% in words along with numbers

@echo off
:Loop
echo Enter a number:
set /p num1=  
set /a sum1="num1 * 100000"
echo The total is %sum1%
goto :Loop
0
Dear Experts, is  there any method to check the uninstalled apps in a PC/laptop? Can we do it via CMD or powershell?

Many thanks in advance!
0
We have a storage in production and one storage in DR site. The link between sites are not strong enough to support replication.
How to copy last  1 day or 2 days files from production storage folder to External HDD using a script.
Then copy HDD to DR storage.

Appreciate
0
Cloud Class® Course: MCSA MCSE Windows Server 2012
LVL 12
Cloud Class® Course: MCSA MCSE Windows Server 2012

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

We have some upgraded going on some of our web severs.
Till that time we need check many urls manually daily.

I want to write a vb script to check urls if it is up or not and send us status report through mail.

urls address start with https:// and we need to use F5 Token and disable proxy setting to connect those server.

we don't have power shell access as well.

could somebody please help me to write a vbscript or bat script to automate these stuff.
0
Hello Experts,
How can I run multiple DOS commands inside a C# program?  1. The first line should change the directory to FolderOne.  2. In FolderOne, I need to execute an XXX.Exe file. Please let me know.  

Thank you very much in advance.
0
A lot of folders can be robocopy to another server recently. The following errors are logged. Any idea ?

Thx

2018/05/02 03:12:36 ERROR 64 (0x00000040) Scanning Source Directory Z:\Tsegxxxxx\
The specified network name is no longer available.


2018/05/02 03:12:36 ERROR 64 (0x00000040) Accessing Destination Directory D:\ARCH17\Tsegxxxx\
The specified network name is no longer available.
0
I want to rename all of Mp4 files to 1 2 3 4 5 6 7 ... so on

but the numbers sequence should be based on the created date-time   so all of my files are created today but their timing for creating them are different.

so 1 should be the name of the latest time of creation of the Mp4 and then 2 should be the name of second latest created

how can i do this automatically?
0
Hi guys,

I would like to rename multiple files by replacing the name by their first 19 characters of their old name.
Can you please assist.

Orginal file naming:
0000000000000376279.xml.3be03b33b7fd403bb03fe27fd1167ffc.error
0000000000000376280.xml.7c157a6cecf644cf934e919292339904.error
0000000000000376281.xml.80d7062d6cbc4c689d7c82c1e6ec35c7.error
. . .
. . .

I want to achieve:
0000000000000376279.xml
0000000000000376280.xml
0000000000000376281.xml
. . .

script used in CMD doesn't work
exception: command is incorrect

ren -n 's/(.{19}).*(\.error)$' *.xml

Open in new window


Thank you
Darius
0
I need to create a batch file that backs up a file then deletes the original file so that I can download a file with the same name.

As follows:

del myfileBackup.csv
copy myfile.csv myfileBackup.csv
del myfile.csv
...
myapplication --username --password --formID  --output myfile.csv

The problem I am running into is when a file is deleted/renamed it ties up that file and prevents the next step.

I get an error message

The process cannot access the file because it is being used by another process.

This caused my import/download to fail.

I appreciate any help that can be provided.

Thanks!

Michael
0

Microsoft DOS

13K

Solutions

12K

Contributors

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.