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,

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
0
OWASP: Avoiding Hacker Tricks
LVL 13
OWASP: Avoiding Hacker Tricks

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

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.
0
Need CMD command for tasklist to sort Mem Usage in descending order?
0
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?
1
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?
0
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
0
Hi,

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
A
0
Hi

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
A
0
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.
IF EXIST k:\Mike GOTO NONEED
md k:\Mike
:NONEED
IF EXIST k:\Downloads GOTO NONEED01
md k:\Downloads
:NONEED01
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.
0
I have approx 2,000 text files in this format:

0.5000
0.0000
0.0000
-0.5000
2837500.2500
2272499.7500

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.
0
CompTIA Security+
LVL 13
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

Hi

Please find below DOS script.

@echo off
setlocal

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

)

popd

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
A
0
I have directory structure similar to this

/images/widgets/widgetXXXXXX/xxxxx-LFS.pdf

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
/images/widgets/widget/11111/11111-LFS.pdf
would get changed to /images/widgets/widget/11111/11111-RENAME.pdf

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

/images/widgets/widget/33333/33333-LFS.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?
0
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?
0
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
0
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
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
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
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
Become a Certified Penetration Testing Engineer
LVL 13
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

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

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.