Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x

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

So here's the data I am looking at..I have a single folder files named this way:
file one (1).ext
file one (2).ext
file one (3).ext
file two 1.ext
file two 2.ext
file two 3.ext
file three a.ext
file three b.ext
file three c.ext ... etc etc

There are about 250,000 of these files in a single folder. I am trying to create a batch file where it will read the name of the file and create a folder based off of the text thats the same and stops when it reaches where the file is different and moves on to the next folder. Then copies the files into the created folder.

For example in the set above, I would end up with three folders: file one, file two and file the each with the 3 corresponding files moved to the correct folder. I came up with as much below but I cant figure out a way to get it to stop reading the file name when it reaches the "(" or the number or the different letter or whatever may be different in the file name. What I end up with is a folder for each file (full file name) and the corresponding file in that folder.

Heres my code:

@echo off
setlocal enabledelayedexpansion
for %%A in (*.ext) do (
   echo file found  %%A
   for /f "delims=" %%B in ("%%A") do set fname=%%~nB
   for /f "delims=" %%C in ("%%A") do set fextn=%%~xC
   for /f "tokens=1* delims=_" %%D in ("!fname!") do set folname=%%D
   echo folder name !folname!
   if not exist "!folname!" (
      echo Folder !folname! does not exist, creating
      md "!folname!"
   ) else (
 …
0
Visualize your virtual and backup environments
LVL 1
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

hello experts
i am using below powershell script to telnet my network device and do some automatic task, for example change WIFI password and send email out daily, while i test it connect to network devices such as router and switch, it works, but when i try to using this script connect to Cisco WLC it failed because WLC do not support raw telnet mode any more so it drop the telnet connection come from my script. for i am new for powershell, could you help me do some modify for my script so that it not using raw telnet mode while connecting to network device?
thank you

Function Get-Telnet
{   Param (
        [Parameter(ValueFromPipeline=$true)]
        [String[]]$Commands = @("username","password","disable clipaging","sh config"),
        [string]$RemoteHost = "HostnameOrIPAddress",
        [string]$Port = "23",
        [int]$WaitTime = 1000,
        [string]$OutputPath = "\\server\share\switchbackup.txt"
    )
    #Attach to the remote device, setup streaming requirements
    $Socket = New-Object System.Net.Sockets.TcpClient($RemoteHost, $Port)
    If ($Socket)
    {   $Stream = $Socket.GetStream()
        $Writer = New-Object System.IO.StreamWriter($Stream)
        $Buffer = New-Object System.Byte[] 1024 
        $Encoding = New-Object System.Text.AsciiEncoding

        #Now start issuing the commands
        ForEach ($Command in $Commands)
        {   $Writer.WriteLine($Command) 
            $Writer.Flush()
            Start-Sleep -Milliseconds $WaitTime
       

Open in new window

0
Hello,

what I would like is a batch file that will get the folder structure of the drive into a menu structure so that you can select the folder you want to go into, and once you select a folder from the menu, the subfolders of that folder would then be listed in a menu as well, and so on and so forth as deep into the folder structure as you want to drill down to. And in each menu would have a "backup current folder level" and a "list all contents of current folder" and if possible include a "go to previous folder" option.

 Basically I would like to run the batch file and be given a menu of the folders only of the c drive, then be given an option to either backup the current folder, list the files of the current folder in case I wanna to only backup one file from that folder, or select a subfolder and then be given the same options with the addition of the go to previous folder option for subfolders.

 I've tried and tried to write something like this but I'm not a strong batch script writer and just can't get anywhere with it.

 Thank you very much in advance for your help,
Ryan
0
i have a folder called FLORIDA and in that folder i have all the user home folders.

within the home folders are .pst files.

how can i copy all the .pst files and keeping the same folder structure?

thanks
0
Hello Experts,
How does ping multipal server IP from a batch file, i need output of ping reply, route info (source interface)  & color in background (if TTL is up output should be in Green otherwise Red).

Example:-
C:\Users\MainLogin>ping -r 1 192.168.7.1

Pinging 192.168.7.1 with 32 bytes of data:
Reply from 192.168.7.1: bytes=32 time=31ms TTL=254
    Route: 3.3.3.1
Reply from 192.168.7.1: bytes=32 time=31ms TTL=254
    Route: 2.2.2.1
Reply from 192.168.7.1: bytes=32 time=37ms TTL=254
    Route: 1.1.1.1
Reply from 192.168.7.1: bytes=32 time=32ms TTL=254
    Route: 3.3.3.1
0
Hi Experts,

We are changing our servers to virtual servers, and for protection sake our IT doesn't want map drives to our data server, therefore for getting access I would need to type \\MyServerName and this would always prompt me for a user name and password.

How do I program these settings in Access?

Also we currently have some data residing in SQL. and currently have DSN files storing all connection info, and in Access linked table manager we just point to that DSN.

How will all these get accomplish w/o saving a DSN locally?
0
With robocopy, is it possible to move any files from the destination to another folder whenever the source file has been removed ?

1. Any files / folders in source will be synchronously exactly with that in destination.
2. Files / folders that are removed from the source will be moved to another folder

Thx
0
I am using this type of batch file command

SET date=%date:~10,4%-%date:~4,2%-%date:~7,2%
set SAVESTAMP=%TIME::=-%

echo f | xcopy /f /y "C:\path\filename.txt" "D:\archive\filename%date%_%SAVESTAMP%.txt"

And it is creating the same file in my archive from 2-3 times. I've checked the original directory and there is only the one filename.txt file.

They all have the same date modified and size:

But the SAVESTAMP varies:
2017-12-13_14-35-19.03
2017-12-13_14-50-19.03
2017-12-13_14-55-48.94


thanks!
0
We have a very very old labeling program that the electrical department would like to keep using (The printer works and they still have tons of labels in supply) but the program is dos 32bit and the company is no longer in business. Their computer is windows 10 64 bit. I cannot run a 32 bit dos program in windows 64 bit command prompt (at least haven't been able to) so I installed virtual box and installed Doss 6.22. The program works fine but i cannot get it to access lpt1. does anyone know the steps involved (in windows 10 and in the vbox dos) to allow the doss 6.22 to print to lpt1?
0
HI Experts

Could you advise what is the best way to source two property files inside windows batch file and use those property value in the batch script.

Scenario:
1. I have around 20 property/value in a file1.properties and file2.properties files. Assume file1 and file2 has 10 each...coming from two different source (Hope I can concat/append into one single file)
someprop1=somevalue1
someprop2=somevalue2
someprop3=somevalue3
.
.
someprop20=somevalue20

Open in new window


2. Have few batch files, where I would like to source above file1.properties & file2.properties (or merged single file) files inside these batch files and use those property value where ever required.
3. I'm used to to Linux way of source <file1.properties>. But looks like this is not possible in Window Batch? :)
4. In case file1.properties was populated with additional property/value dynamically. Instead of 10...it can have 15 in the future.

Could you help, what is the best way to achieve this please?
0
Become an Android App Developer
LVL 11
Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Hello all,

Using Borland C++ 4.52 on a Windows Virtual PC in XP Mode.

I am writing what I thought to be a pretty simple DOS program.  It is basically opening files, filling up structures, printing structure information to a file and that's it.  The files are binary and are less than 32 Kbytes, most are 1K or less.   I am 75% of the way done, it has been running fine up to now.  I just added some code to finish it off, and now I am getting this error at runtime:

"The NTDVM CPU has encountered an illegal instruction.
CS:00cc IP:0106 OP:ff ff 00 00 00 Choose 'Close' to terminate the application."

The thing is, the code I added is just a repeat of the same code that was at the beginning but to different structures.  Seems to have something to do with the code size?  I don't know.  I am not that familiar with memory management.  However, when I removed the stuff I had added, it works again.  

I am attaching both the main code and the extra code I am trying to add.

I would appreciate any guidance.
extracode.txt
main-code.txt
0
Hello,
 I try to use the winscp.com command line with the pageant.exe tool.
 The goal is to bypass any question related to my password.
 I know the pageant.exe; it works very weel with the putty.exe and plink.exe.
 What is the exact syntax for the command line ?

 I try the 2 command without success :

 winscp.exe /ini=nul sftp://root@hostname /privatekey=path\file.ppk /script=path2\command_script.cmd /log=path3\log_file.log

 winscp.exe /ini=nul /script=path2\command_script.cmd

 ...considering that the "command_script.cmd" include the path for the SSH Key (ppk), starting by a "open" Again, the script ask me to provide the user Root password. It seems that it doesn't recognize the PAGENT process

 Regards,
0
Hi Experts,
We have multipal windows system in network, in BOD process we need to copy some files in every systems manually, its a time taking process for me. Please suggest any bat (automatic) process to short out this trouble. Every systems having user name & password.
0
while repairing pc's i often boot from the windows 10 install USB stick into command prompt
questions :
1- what commands are available here?
2-can i change the keyboard layout to AZERTY ? if so - how?
0
Hello Experts,
how does make a bat file for continuous Ping multipal IP with background Colour changes ?
for example:-
start ping -t 192.168.207.11 -l 0
start ping -t 192.168.207.12 -l 0
start ping -t 192.168.207.13 -l 0
start ping -t 192.168.207.14 -l 0
start ping -t 192.168.207.15 -l 0
0
I have this old batch file that I used to upgrade a software and since it is time for another one I have tried creating a GPO and assigned it under User Configuration>Windows Settings>Logon.

But when testing with a user logging on the batch file wont run but when manually clicking the file it runs perfectly fine!

Here is the code:  xcopy "Source" "Destination" /S /C /I /H /R /Y

Users have a full time mapped drive from where the source file is copied to the local drive C:\Folder

Note that robocopy is the same and doesn't run automatically.
0
Hi.

I have Dos application run on the latest Dosbox SVN Daum and printer Epson LQ350 directly conected to LPT1. When i print document from dosbox, printer prints page without last 5 lines. When i exit from dosbox to windows, printer finish printing last 5 lines. Did anyone know, what i must setup, when i want print whole page without exiting dosbox?

Thanks
0
HI,


iam looking for a solution to count the files in folders & subfolders , calling for a path from the Main DIR.

The output will be Main folder name
(1) Primary folder  (Only name mostly)    (2) All the list of subfolders with count of files    (3) Only file extension.

This will include any empty folders

Also wish to know if any alternate tools which can copy large files in lesser time. ( From Dir to Dir). I have tried xcopy on Dos prompt even though it takes lot of time.
0
Hi Experts,

I have some tasks that currently users must do it manually in daily bases, however since this is prone to errors, the manager would like it should get automated done via code.

1- Look for specific file in default download folder that name starts with Tables_TodaysDate_LatestNumber.Zip (See attached).
2- Extract it to specific folder (C:\Application)
3- Delete old File C:\Application\Tables.MDB
4- Rename extracted file (something like Tables_2017-Oct-30_2230.mdb) to Tables.MDB

Would prefer it done either by calling some DOS commands from VBA or just using native VB functions if possible.

Thanks in advance.
Capture.PNG
0
NFR key for Veeam Backup for Microsoft Office 365
LVL 1
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

I received an excellent response to my question of deleting files based on match and amount of days old.   Initially I was told they should delete based on age of file and if they have a matching .xxx file.    That has since changed to:   files should delete based on if there is a matching .xxx file and only if it is older than 3 days (regardless if the other files are older).  

The script help I received before from Bill Prew looks like:

@echo off
setlocal EnableDelayedExpansion

rem Define folder to process
set "BaseDir=C:\Users\ad9f2p\TEST CLEANUP"

rem Look at each .XXX file
for %%A IN ("%BaseDir%\*.xxx") do (

  rem Reset delete flag, and check all files with this same base filename
  set DeleteFlag=Y
  for %%B IN ("%BaseDir%\%%~nA.*") do (

    rem Get dyas since last modified (using VBS helper routine)
    set Fileage=0
    for /f "tokens=*" %%C in ('cscript //nologo fileage.vbs "%%~B"') do (
      set Fileage=%%C
    )

    rem If any file found less than 3 days old, do not delete the group
    if !FileAge! LEQ 3 (
      set DeleteFlag=N
    )
  )

  rem If all files found older than 3 days, delete them all
  if "!DeleteFlag!" EQU "Y" (
    ECHO del /q "%BaseDir%\%%~nA.*"
  )
)

Open in new window

Can I add a nested If statement to the section:

    rem If any file found less than 3 days old, do not delete the group
    if !FileAge! LEQ 3 (
      set DeleteFlag=N
    )

Open in new window

Can I check the file age on only the .xxx files and delete the corresponding files that match then, only if the .xxx file is older than 3 days?   I've tried doing this by rearranging the logic, currently it deletes everything with a .xxx file:    What am I missing here?


Open in new window

0
I'm trying to stream content using Livestreamer from YouTube to VLC. However, the streaming starts but the video is frozen. I notice no audio is present as well. Any ideas what It could be? I tried the smallest resolution 144p and I get the same results as if I try at 1080p.
0
Rename this sort of multiple file names
"20171014_user_id_17875988194160002_1507954651_replay.mp4"
to
"String1 user_id String2.mp4"

String user_id is dynamic in nature and not fixed and not known in advance
0
device driver not found BANANA
NO VALID CDROM device drivers selected

I had downloaded the ms dos 6.22 iso file and copy it into floppy by winimage but when I try to install ms dos it shows this error and in my system I don't have cdrom or dvdrom , I only have floppy drive with 500 mb hard disk.
0
Dear Experts,
We need codes for batch file to check a particular file is modify time is within last 30 Min.
If file is modified in last 30 Min then execute another batch file

Else end the script.

Requesting to help in the same.

Regards,
Girish T.
0
I will have several files during the day. Cannot select the latest with timestamp, i need to have to file with the greatest id.

The file name is in a format: [standardname]_[date]_[id].csv. Eg invoices_2017_09_19_186.csv
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
>