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

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
A
0
Angular Fundamentals
LVL 12
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

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.
0
I run the following script .cmd file



@echo off
setlocal enabledelayedexpansion

set startTime=%Date% %time%
echo Start Time: %startTime%

Robocopy /s \\Image1\Images\ICSStorage\20080211\C43F9AAF-B3F1-46EC-A2BE-E3B8BED78B7E.tif      \\testsql3\NGProductionDocs\NGSourceDocs\ICSStorage\20080211\C43F9AAF-B3F1-46EC-A2BE-E3B8BED78B7E.tif      /dcopy:t /mir /FFT /Z /np /tee /log+:D:\NGProductionDocs\Config\Log\CopyOverLog\CopyOver_ICSStorage.log
      

echo Finish Time: %Date% %time%
pause

I have the following error

'\\testsql3\Config\Maintenance\NGPRDToTestSQL3'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
Start Time: Sun 01/13/2019  0:07:31.87

 Log File : D:\NGProductionDocs\Config\Log\CopyOverLog\CopyOver_ICSStorage.log

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows

-------------------------------------------------------------------------------

  Started : Sun Jan 13 00:07:31 2019

   Source : \\Image1\Images\ICSStorage\20080211\C43F9AAF-B3F1-46EC-A2BE-E3B8BED7
8B7E.tif\
     Dest : \\testsql3\NGProductionDocs\NGSourceDocs\ICSStorage\20080211\C43F9AA
F-B3F1-46EC-A2BE-E3B8BED78B7E.tif\

    Files : *.*

  Options : *.* /FFT /TEE /S /E /COPY:DAT /DCOPY:T /PURGE /MIR /Z /NP /R:1000000
 /W:30

------------------------------------------------------------------------------

0
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
0
What is the command line, within a batch, if possible, to start that batch in Administrator mode?
Or would another batch be needed to trigger this batch in Administrator?
0
Hi

Please can you help me convert a file call distlistcontacts.xlsx to distlistcontacts.csv located in c:\o365update\ via command prompt.  I have tried a scripts on the web and cant get them to run. Excel is not installed on the pc where the batch file will be scheduled to run from .

Regards


Simon
0
My client asked me to get the programs and data from an old PC.   Its an old 386/486 that defines the tracks, sectors and cylinders in the bios.   (an IDE drive with no partition table).   I tried connecting its drive via USB to a newer PC, but none of the data is visible using windows 7, Windows XP, DOS 6.22, Hiren's boot disk, etc. on the newer PC,  probably because there is no partition table.  Its too much data (over 30gb) to try to copy with 750kb or 1.4mb diskettes and those PCs don't have CD drives.  

I was able to get a sector by sector image copy to a USB drive -- And plan to try to restore it to a newer drive, but I doubt that will solve anything -- since it will probably restore without a partition table.  

Many years ago I used to have all sorts of great DOS based tools for this sort of thing.  Some may still exist in my basement or one of the software archive sites, but at my age, I don't remember which to use or how they worked.   I'm guessing an old pre-Windows XP might be able to read this data and be able to write to a partitioned drive (I don't believe those old versions knew about USB).    

Any help would be much appreciated.
0
Hi,

I am looking for dos command to force delete file/files by its name from folder. No matter any user uses/open that file. I don't want all files in the foleder get deleted when I run this code. Thats the reason why I am asking for a code where I can put file names and that code will delete the files I needed.

Thank you
0
Hi,

I have a source file named 'Get_SubVar_Yr.log' that has these three lines:

Processing...
 ALL.Act_Yr=FY18
getsubstvar completed successfully

I'm trying to set a variable equal to the value after the = on the 2nd line.  So my variable named 'theyear' would equal 'FY18'.

for /f "tokens=1,2 skip=1 delims==," %%A IN ("D:\Get_SubVar_Yr.log") DO @echo %%B

Open in new window


I'm not sure how to resolve the 'delims==' part to start.  Is that possible?
Also do/should I need to skip the first line and did I get that correct?
Will the 3rd line hose anything up?
Is For /f   the correct method in the first place?
1
What is the WMIC command to get the Server/machine SID, not the domain SID?

I keep reading how to get useracoount SID or using Powershell.

What I require is using WMIC command only.
0
Introduction to Web Design
LVL 12
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

What does the double percentages before the numbers mean? "%%3%%8%%9.CRL"

CERTUTIL -SETREG CA\CRLPUBLICATIONURLS "1:%WINDIR%\SYSTEM32\CERTSRV\CERTENROLL\%%3%%8%%9.CRL\N2:http://pki.ECHOs.com/certenroll/%%3%%8%%9.crl\n10:ldap:///CN=%%7%%8,CN=%%2,CN=CDP,CN=PublicKEY SERVICES,CN=SERVICES,%%6%%10"
0
is there a way to add to the windows credential manager via the command prompt
I'm not referring to cmdkey but the actual windows credential manager apparently they are not the same thing.
When I use cmdkey /generic:TERMSRV/server /user:username /pass:password
it works fine it I run mstsc /v:server  
but if I run it from the desktop by clicking on a shortcut it prompts me for the password; however, if I put the credentials in windows credential manager I do not get the prompt

so, is there a a command to add a username and password to windows credential manager ?
I don't want any user interaction I want to run it through a bat script or psexec or something.
Thanks!
0
Hi Experts,
I'm looking for either code or script that will do the following
loop thru all files of specific folder, not including sub folders (folder should only contain CSV files).
delete all the contents of those files, but do not delete the file itself.
Thanks
0
I have a few thousand files and the processed equivalent files in a folder  ( Windows Server 2016 machine).  But there are a  few files which missed the processing
An example list will be
Doc1
Doc1.Timestamp.lck
Doc2
Doc2.Timestamp.lck
Doc3
Doc4
Doc4.timestamp.lck

IN the sample, Doc3 is not processed. How can I get the list of   files not processed  when the list is huge?
0
Hi

I am using below dos command to upload excel reports on to SharePoint. It is working fine. Only issue is, if someone opens the current file from SharePoint, below code is unable to upload updated file onto SharePoint, because the same file has been checked out to someone.  How can I solve this issue? I want a dos command which can  kill the same file (which are there on the code) from SharePoint before upload the fresh one.

@echo off
setlocal

echo Start Copy

set SOURCE_DIR=C:\abcd\efg\hij
set DEST_DIRS="Y:\"
set FILENAMES_TO_COPY="abcd.xlsx","xyz.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"
    )

)

popd

echo. Done.
exit /b

Really appreciate help on this

Thank you
0
Windows Batch file to count a set "N" number of files from a single source folder,merged multiple files together into a single output file that contains <= N number of records, and move processed files to a save directory folder.

Request for a window bat file that can be run from command/CMD prompt.  Windows 7 environment.

Windows Batch file to copy a set "N" number of files from a single source folder to an output file, move processed records to a single save folder.  The single source directory may contain 1 up to a million files.  
Need to copy 200 files at a time to a newfile_N+ that should contain <= 200 files per newfile_N+ until all records have been read and processed.

Input file extension: *.hl7
Output file newfile_N+ extension: *.txt

Source directory - C:\temp\source
Destination directory - C:\temp\output\newfile_N+.txt
Destination directory - C:\temp\processed

For the purpose of demonstration I have attached (5) sample hl7 files.
Each newfile_N+.txt file should contain <= 2 records per file.

Prior to kicking off the batch file.  All (5) source files would be all be in the (C:\temp\source) directory.
Upon completion of the batch program running.  The expected output once the bat file has run would result in the following:

C:\temp\source
      dir: contains no files *.hl7 files
      
C:\temp\output
 dir: newfile.txt, newfile1.txt, newfile2.txt
      Note: Each of these files contains <=2 records each, max is 2 records per file
      ==> newfile.txt …
1
Anyone have a good solution to rename recursively all the files in a directory tree that begin in _ or contain ()!$% etc?  I am trying to start a massive FTP upload but it fails due to the names.  I have already used CMD to recursively remove temp files and such but the ren command doesn't work recursively.
0
Request for a window batch file that can be run from command/CMD prompt.  Windows 7 environment.

Windows Batch file to move a set "N" number of files from a single source folder to a destination folder.  The single source directory may contain 1 up to a million files.  Need to copy 200 files at a time to a destination folder_N+ that should contain <= 200 files per destination directory.

Once all the files are moved to the destination folders, would like to merge the multiple files per individual destination folder into one single file. (copy *.hl7 newfile.hl7)

File extension: *.hl7
Source directory - C:\temp\source
Destination directory - C:\temp\outputN+

For the purpose of demonstration I have attached (5) sample hl7 files.  
These (5) files would be all be in the (C:\temp\source) directory.  
Expected output would result in the following:

C:\temp\output
 dir: new 1.hl7, new 2.hl7
 copy *.hl7 newfile.hl7

C:\temp\output1
 dir: new 3.hl7, new 4.hl7
 copy *.hl7 newfile.hl7

C:\temp\output2
 dir: new 5.hl7
 copy *.hl7 newfile.hl7

Note: The folder names may contain spaces, also the file names may contain spaces.
source.zip
0
Hi Experts,

I have the following command running as a batch file (on task scheduler) in an hourly bases.
xcopy "C:\Users\bfuchs\Dropbox\Caspio\caspiotables.zip" f:\Conversion\Caspio\ /y

Open in new window


would like to have this running in another pc as well as a backup.

However would prefer to have the following modifications

1- To first check for date/time that file f:\Conversion\Caspio\caspiotables.zip when it was modified, if it was not within the hour then perform the task.
2- Get an email informing it was done (so i know the 1st one failed).

Thanks in advance.
0
OWASP: Avoiding Hacker Tricks
LVL 12
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

Hi

I am in search for dos command which I need to include in the batch file. The code I am looking for is to copy excel files from a Upload folder and paste it in the archive sub folder(which sits in Upload folder). Each time I run batch file, it should copy files from Upload folder and paste in archive folder. If the files with same name exist inside archive folder, the dos command should over write only those files with latest files, leaving other files as they are.

Hope you get my point.

Any questions please let me know.

Thank you
0
Hi,

I am searching for a dos command which can cut files from a given folder and paste those files in to an Archive folder which sits along side with the files need to be uploaded into. There are folders with space in its name. I have to insert this command in a bat file. I use below code for my other tasks and its working fine, but it does not do cut and paste, it does copy and paste.

@echo off
setlocal

echo Start Copy

set SOURCE_DIR=C:\Nat\Reports\Reports
set DEST_DIRS="X:\", "N:\Reports\Production Repts\Reports"
set FILENAMES_TO_COPY="2018All Projects_New.xlsx","2017Report_New.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"
    )

)

popd

echo. Done.
exit /b

Thank you
A
0
BATCH FILE:  The following command overlooks and does not copy files in directory  D:\Thunderbird

xcopy "D:\*.*" Y:\JKB\Backup\D\ /d /s /r /y /f

Open in new window


Other files in other directories are copied.

Any ideas???
0
Hi,

I am looking for a script which loads files to SharePoint daily basis. I use windows 10 and 7 laptops. I have created mapped drive to SharePoint on my computers. I was using batch file to migrate data quite successfully. But now I have to migrate data into different folder and links in SharePoint. My batch file(dos commands) is not capable to do that.
0
Hi Experts,
How to grep connected tcp IP & Port connection then forcefully kill using batch.

example;-
netstat -a output is

Active Connections

  Proto    Local Address                        Foreign Address                State
  TCP       192.168.1.101:49366            192.168.1.55:65000          ESTABLISHED
  TCP       192.168.1.101:49475            192.168.1.55:64000          ESTABLISHED
  TCP       192.168.1.101:49384            192.168.1.55:63500          ESTABLISHED
  TCP       192.168.1.101:49396            192.168.1.55:22                 ESTABLISHED

Need to forcefully kill all TCP connection which is connected with 192.168.1.55
0
Hello Experts,

I need a help I've a batch script for folder locking, in this script I've set a password for folder access after that I convert this batch to exe & give it to users.
Now user wants to create own password & after creating the password once user put password for folder access it should not be appear it should be in form in dot or blank.
Most important thing i want set a default password in case users forget password in that case admin should open that folder from default password, also main folder, sub folder & files which is store in Vault folder should not be find if anyone try to find using windows search.

Script:-

cls
@echo off
mode 50, 10
title   ~Safty Vault~

echo.
(SET OUT=3F)

color %OUT%

if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Vault goto MDLOCKER
:CONFIRM
echo Are you sure you want to lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Vault "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to unlock folder
set/p "pass=>"
if NOT %pass%== password goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Vault
echo Folder Unlocked successfully
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.

Top Experts In
Microsoft DOS
<
Monthly
>