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

Hi Experts,

I have this question after resolving the following

https://www.experts-exchange.com/questions/29109077/How-to-concatenate-all-files-from-one-folder-into-one-ignoring-headers.html#a42623555

How can I modify the command to

1- Ignore all headers
2- include only files created in specific date range
3- include only files with specific names, like "*PatSched* and "*PatChanges*"

Thanks in advance.
0
CompTIA Cloud+
LVL 12
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

I have one folder "destination" where I have files and their time stamps (created, modified) I would like to preserve when I overwrite a few of those files with updated version of those files.

example

Destination Folder 
File.mp4- Created 01/01/01 (size 500mb)

Source Folder 
File.nmp4 - Created 12/12/12 (size 4.00gb)

Open in new window

I overwrite the file in the Destination folder with the new updated version from the Source Folder but keeping the original file in the destination folder timestamps

End Result (new overwrite file in the destination folder with original file timestamps)

Destination Folder
File.mp4 - Created 01/01/01 (size 4.00gb)

Open in new window


I have written a batch file to move the file as so

 
robocopy "Source" "Destination" /E

Open in new window


and this handles my overwrites and moving of my files perfectly, but I haven't found a way to preserves timestamps. I am looking for command-line so I can implement it in a batch file. Any help will be appreciated. I been reading flags for robocopy etc but maybe I'm reading it wrong or something but I haven't figured it out yet.
1
Hello,

How do you create an executable file to open a non-executable file?

I just began using a Corsair K95 RGB keyboard (which includes 18 programmable G-keys) along with its software (CorsairUtilityEngineSetup_2.24.50_release). While assigning macros to the G-keys, I discovered that while the software does allow you to run an executable file (*.exe *.bat *.cmd), there is no option to open a simple non-executable file (eg .txt, .xls, .ahk, .png, etc).

That seemed a bit odd to me but it was confirmed by Corsair tech support so during the conversation I asked about possible workarounds and the response was that I could create an .exe or .cmd file to open the desired non-executable file.

So for example, suppose you want to open the following Excel file:

    C:\Users\UserName\FolderName\FileName.xlsm

How would you create an .exe or .cmd file to do that?

Thanks
0
Hi Experts,
I have the following batch file
@echo off
setlocal

set  tm=%time: =0%
set  tm=%tm::=%
set dt=%date:~10,4%%date:~4,2%%date:~7,2%

copy  C:\Users\bfuchs\Dropbox\Caspio\CaspioTables.zip  h:\CaspioTablesDaily\CaspioTables%dt%%tm:~0,4%.zip

copy  F:\Data\SkilledNursingVisitNotestbl.mdb  h:\AccessTablesDaily\Skilled_Nursing_Tables%dt%%tm:~0,4%.mdb

Open in new window


Would like to have for the second file (the access file), to zip it into the destination, instead of just copying.

How can I accomplish that?

fyi- I have windows 7.

Thanks in advance.
0
Hi Experts,

We have windows server 2008 along with multipal users they have only remote desktop rights & i dont want assign administrator rights,

but a there is a software which need administrator rights (run as administrator) permission to execute from users, we had manage till startup time manually to run as a administrator with password but now there is more than 50 users that's why i can't manage manually.

I need a batch file which have store administrator password, I'll paste that batch to every user Desktop & locate the software path to in batch file run as administrator.



Path Example :-
for user1
D:/user1/Gm_4.1.1.1_05082018_PAN/EnhanceT.ext

for user2
D:/user2/Gm_4.1.1.1_05082018_PAN/EnhanceT.ext

for user3
D:/user3/NEW_4.1.1.1_12082018_PAN_A/EnhanceT.ext

for user4
D:/user3/Gm_4.1.1.1_05082018_PAN/EnhanceT.ext

for user5
D:/user5/Gm_4.1.1.1_05082018_PAN_5/EnhanceT.ext

for user6
D:/user5/Gm_4.1.1.1_05082018_PAN_6/EnhanceT.ext
0
Hi
I need to rename some files

This works if I cd to the directory first

cd \s z:\Path\with\files\in
ren *.jpeg *.jpg

Open in new window



How do I write a simple bat file that takes the parent folder as a parameter and recursively  renames the files skipping over if the files exist

so if a folder had both MyCat.jpeg and mycat.jpg  it won't over right mycat.jpg (Windows file names are not case sensitive) and won't prompt
0
Hi

I need to upload output files into multiple destination folder, Can anyone modify below code accordingly please.

@ECHO OFF
ECHO Start Copy

set SOURCE_DIR=C:\Users\xxxx1\Desktop\kk1
set DEST_DIR=C:\Users\xxxx1\AppData\Roaming\Microsoft\Windows\Network Shortcuts\SharePoint
set FILENAMES_TO_COPY="Report.xlsx", "LondonReport Full.xlsx"

pushd "%SOURCE_DIR%"
for %%F IN (%FILENAMES_TO_COPY%) do (
    echo file "%%~F"
    xcopy /Y "%%~F" "%DEST_DIR%"
)
popd
ECHO. done
exit /b

Thanks
K
0
I am trying to deploy local windows firewall rules to several separate Windows 7 laptops.  We have Novell NetWare in our environment; hence, using Group Policy from a WIndows Domain to propagation to the devices, is not a n option (unfortunately).

I have discovered that if one executes a batch file, with the command:

netsh advfirewall firewall add rule name="NetScaler Gateway Plug-in" dir=in action=allow profile=public program="C:\Program Files\Citrix\Secure Access Client\nsload.exe" protocol=TCP enable=yes

Open in new window


that works really well ( https://support.microsoft.com/en-us/help/947709/how-to-use-the-netsh-advfirewall-firewall-context-instead-of-the-netsh ); but, the problem is that when executing the above command you need to run the command prompt as an administrator.

DOS_1
As you can see if the user does not have admin privileges or does not know the administrator password, then the only other thing I can think is to create 2 batch files and manually copy the files to the user's laptop.  1 file will have the  'runas' command to use the local administrator user account and then to trigger another batch file with the changes:

runas /user:administrator C:\data\mybatchfile.bat

Open in new window


https://www.windows-commandline.com/windows-runas-command-prompt/

So the batch file: mybatchfile.bat will actually have the code that adds the firewall rule(s):

netsh advfirewall firewall add rule name="NetScaler Gateway Plug-in" dir=in action=allow profile=public program="C:\Program Files\Citrix\Secure Access Client\nsload.exe" protocol=TCP enable=yes

Open in new window


Question1:  Is there a way to streamline the deployment approach because our users will require these local windows firewall rules and these users are not administrators on their company laptops.  

Question2:  Is there a way to elevate permissions for a batch file as the script begins executing?  So you will not be prompted for a password?
0
Dear Experts, is there any CMD or Powershell scripts to check domains' expiration dates?

Many thanks!
0
Transpose () filenames from DIR & list them to txt or excel file either via CMD or Macro
The DIR contains sub folders, with files majorly of .tiff extension.

There is a logic while listing them and transpose.
Lets say there are 10 files in a sub folder. We manually rename a particular image in the example"0001_0001.tif" with additional "0001" which reflects as"0001_0001_0001.tif".


0001_0001_0001.tif
0002_0002.tif
0003_0001.tif
0004_0002.tif
0006_0001_0001.tif
0007_0005.tif
0007_0009.tif
0008_0010.tif

Requirement: The file names should be transposed and listed as per the breaker provided ie additional "0001.tif" . The output will look like.

DIR / Subfolder/0001_0001_0001.tif  0002_0002.tif 0003_0001.tif 0004_0002.tif

Thanks!
0
CompTIA Network+
LVL 12
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

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
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
Introduction to R
LVL 12
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

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

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.