Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1051.

Solve : Having issues with "CHOICE" command?!?

Answer»

Hi guys,

I'm building a game in DOS, and i'm having some real issues when I wanted to implement the CHOICE command - never used it before, but it seemed a great way to go..

Here's the code:

echo ----- Welcome to Lands of Horayan -----
echo Press 1 to Start the Game
echo Press 2 for the Options menu
CHOICE /C 12 /N
if ERRORLEVEL == 1 goto Start
if ERRORLEVEL == 2 goto Options
:Start
echo Start Game
:Options
echo Options Menu

However, It is not executing the code correctly, upon selecting "1" or "2" it simply just prints out "Start Game" & "Options Menu" in the command window..? Why is my code not displaying what it should do correctly? Surely if i press "1" it should just print out "Start Game", for example?

Do bear in mind, this is not the actual game, it's just a part i've copied out and modified to make it easier to DETERMINE what the issue is CHOICE  is working fine. 
Batch is not a high level language with lost of  nice things.
It requires the GOTO statement to be used more often.

echo ----- Welcome to Lands of Horayan -----
echo Press 1 to Start the Game
echo Press 2 for the Options menu
CHOICE /C 12 /N
if ERRORLEVEL == 1 goto Start
if ERRORLEVEL == 2 goto Options
GOTO Finish
:Start
echo Start Game
GOTO Finish
:Options
echo Options Menu
:Finisgh
echo finish

Quote

if ERRORLEVEL == 1 goto Start

There are 2 alternative errorlevel formats you can use:

(a) Old MS_DOS IF ERRORLEVEL syntax, levels in descending order

if ERRORLEVEL 2 goto Start
if ERRORLEVEL 1 goto Options

(b) Later NT command language format, levels in any order

if %ERRORLEVEL%==2 goto Start
if %ERRORLEVEL%==1 goto Options


Salmon Trout is right. A descending order needed.
Says descending order right in the help file. Quote from: Squashman on July 13, 2015, 09:31:47 PM
Says descending order right in the help file.
Thank you.Some clarification... this must be about the 10th time I have written this...

The old (true) MS-DOS legacy way of checking for errorlevels was LIKE this

If errorlevel X do_command

This meant "if the errorlevel is equal to or greater than X, do_command". Do_command was USUALLY goto a label. This meant that if you wanted to check for more than one expected errorlevel you had to do stuff like this

some_command
if errorlevel 5 goto egg
if errorlevel 4 goto bacon
if errorlevel 3 goto cheese
echo Errorlevel was 0, 1 or 2!
goto end
:egg
echo Errorlevel was 5 or more!
goto end
:bacon
echo Errorlevel was exactly 4!
goto end
:cheese
echo Errorlevel was exactly 3!
:end
echo Finished...

The errorlevel in MS-DOS and Windows before NT was held in a byte and hence could be from 0 to 255.

In true MS-DOS, if you wanted to actually find out what errorlevel a program or command returned, you had to do something like this...

some_command
if errorlevel 255 echo 255
if errorlevel 254 echo 254
if errorlevel 253 echo 253
... (snipped 251 lines)
if errorlevel 1 echo 1
if errorlevel 0 echo 0

256 lines just to get the errorlevel. All this was very cumbersome, and in Windows NT a pseudo environment variable %errorlevel% was added, which you could test in one line e.g.:

echo %errorlevel%

Also you can use all the compare-ops like EQU NEQ LSS LEQ GTR GEQ. Probably as well to remember that NT errorlevels are held in a 32 signed integer and can be anywhere from -2147483648 to +2147483647 (that's right, you can have errorlevels below zero as well as above, so the old IF ERRORLEVEL might not always do what you expect.)

Further reading:

http://blogs.msdn.com/b/oldnewthing/archive/2008/09/26/8965755.aspx

http://steve-jansen.github.io/guides/windows-batch-scripting/part-3-return-codes.html

(I like Steve Jansen's tip about using powers of 2 for your own return codes, so you can use bitwise OR and test for multiple errors at once.)

http://www.robvanderwoude.com/errorlevel.php


1052.

Solve : Batches as Functions?

Answer»

I thout about seperating code between files and use them as functions.
I had many errors until I realized that the Output of this Funcs must be only the 'ECHO ...' that I need.
In these file there must be ECHO OFF in its 1st line, otherwise each line code become an Output.
Here is a little example. even recursive:
Let's have file Named Func.CMD
We CALL it from Command-Line with a parameter:
Code: [Select]CALL Func.CMD 1The code in Func.CMD:
Code: [Select]ECHO OFF
SET /A X = %1 + 1
IF %X% LSS 10 FOR /F "DELIMS=" %%i IN ('CALL Func.CMD %X%') DO SET /A X = %%i
ECHO %X%

It LOOKS so:
C:\>CALL Func.CMD 1
10

I HOPE SOMEONE can enjoy it
YossiThis can be useful, but its hard to pass things out.

Something LIKE this might work.
Code: [Select]Setlocal enabledelayedexpansion
Set param_num=0
For %%a in ('call func.bat %param1%') do (
Set param_!param_num!=%%a
Set /a param_num+=1
)

1053.

Solve : video files merge with ffmpeg batch ??

Answer»

i have video files on diffrent format (wmv, mp4, mpg, flv) and parted files
and i am USING windows program for merge
but, i wanna merge all files with batch file

ffmpeg command is :
CODE: [Select]ffmpeg -i concat:"file1|file2|file3" -c:v copy -c:a copy "combined.mp4"
and all files last chars ; pt1 , pt2 ... p1 , p2 ...

example :
video1 pt1.wmv ; video1 pt2.wmv ; video1 pt3.wmv .....
video2 p1.mp4 ; video2 p1.mp4 ; video2 p3.mp4 .....
video3 p01.mpg ; video3 p02.mpg ; video3 p03.mpg ...... video3 p99.mpg....

parts name formated

how i can use that command ?
Test this.  The command line has a length restriction so the number of filenames you can use depends on the length of all the filenames.

Code: [Select]echo off
set "file="
for %%a in (*.mp4) do call set "file=%%file%%|%%a"
ffmpeg -i concat:"%file:~1%" -c:v copy -c:a copy "combined.mp4"
pause
foxidrive

sorry, i late

unfortunately
result is



_all   named files, MERGED manual with boiler..... programDid you solve the problem??sorry no

dont working

look to bottom line... filename combined  only.. no merged filename.. and size wrong
must be filename

%%file%%_combinedThe task is unclear but this modification may help you: the change is inside the (......) section.

Code: [Select]echo off
set "file="
for %%a in (080_*.mp4) do call set "file=%%file%%|%%a"
ffmpeg -i concat:"%file:~1%" -c:v copy -c:a copy "combined.mp4"
pause
foxidrive

thx, you wanna help me but,
have much parted files there
but your code creating only one file for all parted and name combined and THATS wrong


filetes_p1.mp4 ; filetes_p2.mp4 ;........;  filetes_p#.mp4  will be merged name filetes_combined.mp4 (%%file%%_combined) or (%%file%%_all.mp4)

filesec_1.mp4 ; filesex_2.mp4 ;...... ;  filesec_#.mp4 will be merged name "filesec_combined.mp4" (%%file%%_combined) or (%%file%%_all.mp4)

and other file name will be this format (for all video format-s : mp4, wmv, flv, mpg, mpeg, mkv, avi)

your code wanna merge different parted and named files

sorry for my lang and explain Quote from: TosunPASA on July 19, 2015, 07:37:25 AM

thx, you wanna help me but,
have much parted files there
but your code creating only one file for all parted and name combined and thats wrong

The problem with my code is that your information was both wrong and lacking details.
Even in your screen shot there are no extensions.

You should have tried my CHANGED code...
1054.

Solve : run batch file every 3 weeks?

Answer»

I want to run a batch file every three weeks to do some cleaning on my computer.
with scheduler i can only CHOOSE between day, week, month and so on. but not three weeks

is there a possibility that i can check if when the last time is has the batch file has run and if this was three weeks ago

i wanted to do this by reading the date in the batch file save this date as a number, and then the next time read this number and compare it. if the number is under 21 days than the batch file shoul not run. otherwise it should run and assigne a new date to the number

has somebody a solution for this or another solution.


thanks

MarcThis should work.

It launches your "run update.bat" when the computer is started on or after the 3 week mark.
It creates and maintains a file in the temp FOLDER.

CODE: [Select]echo off
set "datetest=%temp%\datetest.txt"
if not exist "%datetest%" call :get-date 21
call :get-date 0
set /p d=<"%datetest%"
echo today is "%DATA%" and the target date is "%d%"
if %data% GEQ %d% (
  call "run update.bat"
  call :get-date 21
)
pause

goto :EOF
:get-date
(set day=%~1)
echo >"%temp%\%~n0.vbs" s=DateAdd("d",%day%,now) : d=weekday(s)
echo>>"%temp%\%~n0.vbs" WScript.Echo year(s)^& right(100+month(s),2)^& right(100+day(s),2)
for /f %%a in ('cscript /nologo "%temp%\%~n0.vbs"') do set "result=%%a"
del "%temp%\%~n0.vbs"
set "YYYY=%result:~0,4%"
set "MM=%result:~4,2%"
set "DD=%result:~6,2%"
set "data=%yyyy%-%mm%-%dd%"
if "%~1"=="21" >"%datetest%" echo %data%
the computer will not start every dayThe modifed code above should still work for you.hi foxidrive


that works indeed

thanks for your help



regard

marc

1055.

Solve : Debian and Dos?

Answer»

For my school project we have been asked to talk about the similarities between Linux and Windows, and to relate some of the tasks we have done in school with Windows (both GUI and CL). Does anyone know anything that you can do on either Windows (GUI and CL) and on Debian CL? Also, are there any advantages for either one over the other, such as ease-of-use, or more complex things such as its being easier to create NEW users and assign them to groups?

I have been asked to get primary RESEARCH, so I’m not asking you to write a project for me, just to mention some things that you think are easier on either one.We do not do homework.  Here are some key areas you can consider.
First, Debian is a variant of Linux. Herein think of them as near equal.
A. MS-DOS and Windows started out on the 8086 CPU which had a limited address space and a strange way of doing program segments. Linux was developed for the i386 CPU large address space without need for SEGMENTATION
B. Linux was developed as a community project without the need for a profit plan. The objective was to share work and reward with all.
C. Like UNIX, Linux was meant to support several terminals on one  desktop computer. A number of users could all use the computer at the same time using teleprinters or dumb terminals, also called consoles.

The great thing about Linux was its use as a server for start-up internet providers. It was free and well suited for use as a Internet server. It is still widely used as a web server.

Hope that helps.   

1056.

Solve : If motherboard on DOS computer dies, can I caddy from another??

Answer»

Hi

Im messaging from an archaeology company using a DOS computer call a Advantech AWS-8380tp to run an array of metal detectors (Called a TSS 340) searching for artefacts on the seabed using an ROV submersible.

The ROV has a direct comms link using RS232 on a serial port to this AWS unit which gives us feedback on the screen in its DOS program when it goes over something metallic. 

However!!!! The machine worked for all of a day (it was donated to us) then the motherboard is beeping an error code and has 4 red lights constantly so think its died.  Hard drive seems to caddy ok and can see the shell file when plugged into an XP machine.  I THINK the AWS computer is a 386, and THINK the DOS version is 6.22...

From what I can tell these old Advantech systems (1994) are designed as an all-in-one for deployment in harsh environments  i.e. screen and computer, boots DOS from the internal HDD, and runs the program which talks to the metal detector all in one heavy duty box.  I don't think there is any special components inside to run this system as its only connected by 1 serial port (pins 4 & 5 RX & TX possibly), and a power lead. 

Question is, is there anyway we can run this DOS program from the caddy'd HDD and get it to talk on RS232 comms to our metal detector?  I did TRY to do this from an XP machine by double clicking the shell file but no luck at all other than an error saying 'can not see COM 3 & COM 4'

We're completely out of ideas.  Anyones help/troubleshooting ideas will really go a long way!!

Kind regards and appreciation

Jonny
RPM Nautical
It will not run from a caddy...it will run if installed as primary HDD on any desktop however... Quote from: RPMNautical on July 24, 2015, 04:37:59 PM

The ROV has a direct comms link using RS232 on a serial port to this AWS unit which gives us feedback on the screen in its DOS program when it goes over something metallic. 

than an error saying 'can not see COM 3 & COM 4'

It is also useful to know that Dos comms software is traditionally configured to access a definite com port - and it must be using the same port address and IRQ that the original HARDWARE is set up with, or reconfigured with the port/IRQ on the replacement machine.

What happens when you boot the machine you have?
Is there a screen that displays text?

Or does it beep in a sequence of short or long beeps?  Where are the four red lights?

It's possible that the machine's CMOS battery has passed away and the BIOS settings need to be reconfigured.
At least that is a common fault, and your machine is obviously many years old - was the battery changed?Hey, thanks for the replies. 

FIRSTLY, is there any chance you could quickly bullet point how to install this HDD as a primary HDD on a normal computer? 

In answer to the other questions.  Originally the computer booted fine, tested and worked great.  Next time i went to turn it on I got an error message after the memory test saying 'Verifying DMI Pool Data' then 'Insert system disk and press any key'.  Finally, after removing all the connectors and CLEANING them down thinking it could be communication to the HDD, I now boot and nothing on screen but instead 4 red lights which are right on the back of the motherboard in the top right hand corner. 

The beep code is one 1 second beep, every 3 seconds or so.  I can't actually work out what the red lights are indicated.  They just stay on constant and there is nothing on the motherboard i can see (from an awkward angle) to describe what they are. 

Could this be as simple as the CMOS? The HDD was replaced before it was donated to us but doubt a CMOS would be... but I should still get something on screen surely? Quote from: RPMNautical on July 26, 2015, 03:44:20 PM
turn it on I got an error message after the memory test saying 'Verifying DMI Pool Data' then 'Insert system disk and press any key'

That looks like a CMOS battery problem with the BIOS settings at default and it just doesn't know which boot device to use - and in some very old machines you needed to enter the cylinders/heads/sector values in the hard drive settings in the BIOS.

Quote
The beep code is one 1 second beep, every 3 seconds or so.

But that one seems like a RAM error, if the BIOS is AMI.

The first test to try and solve the RAM error is to remove and reseat the ram modules, as the connections may be a bit tarnished.

Code: [Select]                | 18. What do the AMI BIOS Beep codes mean ? |
                +--------------------------------------------+
Except for beep code #8, these codes are always fatal.
1 beep Refresh failure
2 beeps Parity error
3 beeps Base 64K memory failure
4 beeps Timer not operational
5 beeps Processor error
6 beeps 8042 - gate A20 failure
7 beeps Processor exception interrupt error
8 beeps Display memory read/write failure
9 beeps ROM checksum error
10 beeps CMOS SHUTDOWN register read/write error
11 beeps Cache memory bad

If the machine then boots and the first error is back, replace the battery.
It is still fails, then you can look at replacing the RAM module if you can find an old one.


Having said that - you may be able to use any machine with a COM port and only transplant the actual software directory, inside of which may be a configuration file where the com port address and IRQ number can be changed to match the settings in the new machine.

When booting the new machine and entering the BIOS you will see the com port settings with address and IRQ, and can even change them to match what is already in the config file.

It's possible that the program will run under Windows.

This assumes a few things - if you want better advice and you can zip up and post a link to the software folder then it may be clearer what steps to take.
1057.

Solve : FTP connection?

Answer»

Hi all,
I wrote a batch for extracting the correct weather file from a weather server (see attached autometar.bat)
The files are retrieved with ws-ftp from
account="tgftp.nws.noaa.gov"
user-name="anonymous"
password="[email protected]"
To prevent using  this WS-FTP application:
Q1= I used ftp.exe from windows but that fails to download files;
 it stuck after setting the remote server to PASV

331 Please specify the password.
230 Login successful.
Anonymous login succeeded for [email protected]
ftp>
Invalid command.
ftp> pause
Invalid command.
ftp> type ascii
200 Switching to ASCII mode.
ftp> cd /data/observations/metar/cycles/
250 Directory successfully changed.
ftp> quote pasv
227 Entering Passive Mode (205,156,51,233,165,123)
ftp>


Any suggestions how to implement ftp.exe in this batch?
Tks for your thoughts
Jan



[attachment deleted by admin to conserve space] Quote from: klm149 on July 27, 2015, 08:12:45 AM

The files are retrieved with ws-ftp from
account="tgftp.nws.noaa.gov"
user-name="anonymous"
password="[email protected]"

Jan, I can't log in with those credentials.  The connection fails.Hi foxidrive
as in the screen print attached from ws-ftp>> gov.jpg
you should GET gov-2.jpg

default ftp - passive mode
with anonymous the password is any e-mail account name
(and of course without quotes...;-)

[attachment deleted by admin to conserve space]1) So are you saying you want to add an FTP option to your existing batch file?
2) Why are you using a FOR command to rename all the files.  Just use the rename command by itself!Answer-1:Yes
Answer-2: each file name must have a reference with an UTC hour; these files are refreshed every hour on the server
 %time% generates single or double digit
if it can be done simpler, let me know please.
Thanks for your advice
JanAnswer 2 does not make any sense to me.These two lines of code and the 22 before it make ABSOLUTELY no logical sense.
Code: [Select]FOR %%f IN (23Z.TXT) do rename 23Z.txt 23.txt
FOR %%f IN (metar.txt) do del /q c:\fsd\metar.txtYou do not need to use the FOR command to RENAME or DELETE these files! Quote from: klm149 on July 27, 2015, 10:51:29 AM
Hi foxidrive
as in the screen print attached from ws-ftp>> gov.jpg
you should get gov-2.jpg

It seems to have been a security software on my computer.

Quote from: klm149 on July 27, 2015, 02:46:22 PM
%time% generates single or double digit
if it can be done simpler, let me know please.

yes, you can generate time figures without the leading space.
Use this and then reference the %t% variable instead of %time%

Code: [Select]set t=%time: =0% Quote from: klm149 on July 27, 2015, 08:12:45 AM
I wrote a batch for extracting the correct weather file from a weather server (see attached autometar.bat)

Can you explain which weather file you need? 
Is it just the file from the current hour?the weather file  from the current UTC hour e.g. 06Z.TXT is used and copied as metar.txt Windows FTP client can't be used on this server.

I've investigated and Windows FTP.EXE can put the server into passive mode,
which the tgftp.nws.noaa.gov server requires, but the FTP client itself
doesn't work in passive mode (PASV).

The FTP.EXE also has trouble with the PORT command, from what I have read.

This script shows it connecting and the PASV command implemented, but the permission denied error
when attempting to download the file is because the FTP.EXE is not also in passive mode.

Code: [Select]echo off
set "ftpHost=tgftp.nws.noaa.gov"
set "ftpUser=anonymous"
set "[email protected]"
set "ftpRemoteDir=/data/observations/metar/cycles/"
set "ftpLocalDir=%cd%"

set t=%time: =0%
set t=%t:~0,2%

(
  echo open %ftpHost%
  echo %ftpUser%
  echo %ftpPwd%
  echo quote pasv
  echo get %t%Z.TXT
  echo bye
)>"%ftpLocalDir%\temp.ftp"
ftp.exe -i -s:"%ftpLocalDir%\temp.ftp"
del "%ftpLocalDir%\temp.ftp"

pause
Thank You!
Do you know how to capture 227 Entering Passive Mode (205,156,51,233,128,29) (h1,h2,h3,h3,P1,p2)
After setting the remote site to PASV mode
the client should give a handshake, returning a port to access.
When you add echo type ascii after quote pasv it will return with a port
H1./.h4 (is the IPaddress of the server)   p1, p2
p1*256+p2 gives the port number to listen on the client
hence  permission denied when RETR nnZ.txt

227 Entering Passive Mode (205,156,51,233,237,13
ftp> type ascii
---> TYPE A
200 Switching to ASCII mode.
ftp> get 16Z.TXT
---> PORT 192,168,1,15,14,219
550 Permission denied.
---> RETR 16Z.TXT
550 Failed to open file.
ftp> bye
---> QUIT
221 Goodbye.


So far so good





Quote from: klm149 on July 28, 2015, 11:05:55 AM
hence  permission denied when RETR nnZ.txt

Did you follow my previous post? 

FTP.EXE can't use PASV mode and this is causing the error.I think this is the show stopper...thanks for your efforts
Jan
1058.

Solve : batch file for copy folder?

Answer»

Hello

The code for a batch file

copy folder (my folder name is = my user client on the network username .for example MAY user name is user1 So  my folder ind DRIVE D is User1) from one drive to another copy.

I've tested this code, but did not answer.
Code: [Select]MD D:\bdc94
attrib -r -h -s D:\bdc94\*.*
xcopy  "d:\%username%\*.*" d:\bdc94 /Q /Y /R /S
batch file for use in policy  server 2012(client win7)
tanks
The solution to this problem?

ThanksYour details are conflicting.

Describe exactly what you need to do and someone will provide you with some code.

or test this:

Code: [Select]echo off
robocopy "d:\%username%"  "e:\test folder\%username%" /mir
Thanks
My problem was solved with your code
Good luckHello
I've got a problem in copying some files
Some will not copy files and folders and message retry show. The other files are not copied
How, if did not copy the file access. It is automatically canceled and the next file is to be copied

Thanks

Code: [Select]2015/07/26 08:08:14 ERROR 5 (0x00000005) Copying File d:\Aslani\AppData\Roaming\
Microsoft\Excel\Excel12.xlb
Access is denied.
Waiting 30 seconds... Retrying...
            New File               10382        Excel12.xlb
2015/07/26 08:08:44 ERROR 5 (0x00000005) Copying File d:\Aslani\AppData\Roaming\
Microsoft\Excel\Excel12.xlb
Access is denied.
Waiting 30 seconds... Retrying...
            New File               10382        Excel12.xlb
2015/07/26 08:09:14 ERROR 5 (0x00000005) Copying File d:\Aslani\AppData\Roaming\
Microsoft\Excel\Excel12.xlb
Access is denied.
Waiting 30 seconds... Retrying...
            New File               10382        Excel12.xlb
2015/07/26 08:09:44 ERROR 5 (0x00000005) Copying File d:\Aslani\AppData\Roaming\
Microsoft\Excel\Excel12.xlb
Access is denied.
Waiting 30 seconds... Retrying...
            New File               10382        Excel12.xlbTwo things stop the files from copying:

A) is that you need to use an account with sufficient access privileges to copy all the files, and
B) any files that are locked and in use will not copy, WITHOUT using volume shadow copy techniques.

Your other point can be solved by changing the timeout to zero seconds and the retry count to zero

Add the two SWITCHES SHOWN here.

robocopy /r:0 /w:0Hello

Thanks

1059.

Solve : How to Find the File that is Causing the XCOPY Error?

Answer»

I use the xcopy command in a DOS batch file to backup my personal files and it works fine. However, when XCOPY encounters an error, the error message is displayed, but the offending filename is not. Only files that are successfully copied are displayed (to the screen or logfile) How do I pinpoint the file that is CAUSING the error? Sometimes it's a long path name and the error is "Insufficient memory", but I still have no way of FINDING the offending file. Other times, the error might be "File creation error - The file cannot be accessed by the system". Same problem, I do not know the filename that is causing the error. The error message itself is not what I need help with. It's pinpointing the file that is causing the error, whatever that error might be. I need a way to display the filename BEFORE the copy is attempted. Thank you. Show the code that you use. It will have to be modified 
 to LOG errors. It will run SLOWER, but give you a report.

Also, you may want to use ROBOCOPY.  Here is a link about using it to log errors.


But there is no quick easy solution. You may have to log all file actions and then filter just the errors.


Quote from: mcoad on August 06, 2015, 08:45:40 AM

The error message itself is not what I need help with. It's pinpointing the file that is causing the error, whatever that error might be. I need a way to display the filename BEFORE the copy is attempted. Thank you.

This switch will give you a log if that is what you want.

  /F           Displays full source and destination file names while copying.
1060.

Solve : DOS Command to Move Image Files to another Folder ??

Answer»

I have numerous image files (JPG/PNG format) stored in a folder. I would like to filter out (move to another folder) images that does NOT contain any of the following TEXT :

_thumb ; _tiny ; _zoom ; _std

Example: image_thumb.jpg ; image_tiny.jpg ; image_zoom.jpg ; image_std.jpg ; image.jpg

Output: image.jpg should be moved to another Folder

Anyone CARE to share DOS Command prompt to achieve this ?   

Thanks in Advance.This QUESTION also posted on DosTip.com
http://www.dostips.com/forum/viewtopic.php?f=3&t=6598Sorry about, i am desperate to get an answer pretty soon.  Untested:

Code: [Select]echo off
dir /b /a-d | findstr /v /i "_thumb _tiny _zoom _std" >file.txt
md "Another folder"
for /f "usebackq delims=" %%a in ("file.txt") do move "%%a" "Another folder"
del file.txt
Quote from: mave27 on August 11, 2015, 07:32:39 AM

Sorry about, i am desperate to get an answer pretty soon. 

Homework due in today ? ? Quote from: foxidrive on August 11, 2015, 08:09:19 AM
Untested:

Code: [Select]echo off
dir /b /a-d | findstr /v /i "_thumb _tiny _zoom _std" >file.txt
md "Another folder"
for /f "usebackq delims=" %%a in ("file.txt") do move "%%a" "Another folder"
del file.txt

Thanks  - what part of the code addresses the SOURCE location of the images ?

And - what is the syntax path for "Another folder" ?   Eg: C:\Temp\Folder\ ?? Quote from: patio on August 11, 2015, 08:13:57 AM
Homework due in today ? ?

Actually, it's a e-Comm Project i'm working on. If your images are in C:\images, you just put the BATCH file into that folder and execute it.
It will create a sub folder called "C:\images\Another Folder" and put all the images in there.
Change as needed. Quote from: Squashman on August 11, 2015, 09:03:10 AM
If your images are in C:\images, you just put the batch file into that folder and execute it.
It will create a sub folder called "C:\images\Another Folder" and put all the images in there.
Change as needed.

OK - I put the images in a folder called 'image' & placed the folder on c:/ drive. I then opened c prompt & typed the command.  Getting error: Access is denied ?!

Am I doin' something wrong ?Squashman - what exactly do you mean by <>?

How is different is it from typing out the command from MSDOS prompt ?You can execute a batch file one of two ways.
1) Double click on it with your mouse.
2) Open up a cmd prompt and navigate to the folder with the batch file and type the batch file name and hit enter.

If you are getting errors when executing the batch file then copy and paste everything from the cmd window into a post here.Thanks - working !!

Squashman - thanks for being patient.
1061.

Solve : Error execution batch file from 16-bit aplication on Windows 32-bit?

Answer»

I have installation files creation in NullSoft system 2.46.
(*.EXE files are storage in http://www.zetrozet.com/index.php?load=downtbl&modul=ucto15)

At starting from Windows 32-bit location, from Windows 64-bit location or from 16-bit location application below DosBox in Windows 64-bit location working totally correct.

At initiation from 16-bit location application in Windows 32-bit location working incorrect:
1) proper are unpacking insertion files
2) proper is generating and initiation batch-file
3) UFAND.EXE, that is to be initiation batch file, yet initiation isn't. Instead write out report "type 'exit' to return to FAND". (FAND.EXE, UFAND.EXE is 16-bit location programming language Czech rise.)

For easier determination causes mistaken behaviour stoking NullSoft script, from that is of perceptible and way generation batch file
Code: [Select]!include MUI.nsh
; INST2015.nsi
; Tento skript nainstaluje INST2015.nsi do adresß°e, kterř si u×ivatel zvolÝ
;--------------------------------
!include MUI2.nsh
!define MUI_ABORTWARNING
!define Datum "27.07.2015"
!define DatumCas "27.07.2015 17:29"
!define Rok "2015"
!include MultiUser.nsh
!define MUI_UNICON "zetro20.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "welcome6.bmp"
!define MUI_HEADERIMAGE_BITMAP "header1.bmp"
!define MULTIUSER_EXECUTIONLEVEL Highest
!insertmacro MUI_PAGE_WELCOME
  !define MUI_TEXT_WELCOME_INFO_TITLE "VÝtejte v pr¨vodci instalacÝ programu$\r$\n$\t$(^NameDA)"
  !define MUI_TEXT_WELCOME_INFO_TEXT  "$\tP°ed zaŔßtkem instalace se doporuŔuje ukonŔit vÜechny ostatnÝ programy. TÝm umo×nÝte aktualizaci systÚmovřch soubor¨ bez pot°eby restartovßnÝ vaÜeho poŔÝtaŔe.$\r$\n$\r$\n$_CLICK$\r$\n$\r$\n$\r$\n$\r$\n$\r$\n$\r$\nVytvo°eno dne ${DatumCas}$\r$\n$\r$\nę Zdenýk TrunýŔek, Zet-Ro-Zet, BeneÜov nad PlouŔnicÝ"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!define MUI_FINISHPAGE_CANCEL_ENABLED true
!define MUI_FINISHPAGE_CANCEL_ENABLED_VARIABLES true
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!define MUI_FINISHUNPAGE_CANCEL_ENABLED true
!define MUI_FINISHUNPAGE_CANCEL_ENABLED_VARIABLES true
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_LANGUAGE "Czech_www"
!include FileFunc.nsh
!include WordFunc.nsh
!include WinMessages.nsh
!insertmacro WordReplace
!insertmacro Un.WordReplace
var /GLOBAL outfile
BGGradient 0088FF 663366 notext
BrandingText /TRIMRIGHT "ę Zdenýk TrunýŔek Zet-Ro-Zet, BeneÜov nad PlouŔnicÝ"
RequestExecutionLevel highest
XPStyle on
AllowRootDirInstall false
Icon "G:\I_U2015\{tisk}\zetro20.ico"
OutFile KURZY32.EXE
Function .onGUIInit2
${GetExeName} $R0
${GetExePath} $R1
StrLen $R3 $R1
StrCpy $R1 $R0 -$R3
StrCpy $outfile $R1 "" 1
StrLen $1 $outfile
StrCpy $0 $EXEPATH -$1
StrCpy $0 $0 -1
StrCpy $2 $0 "" -6
StrCmp $2 "{wwww}" wwww nowwww
 wwww:
  StrCpy $InstDir $0 -7
  GetFullPathName /SHORT $0 $INSTDIR
  StrCpy $INSTDIR $0
  goto wwwwend
nowwww:
  GetFullPathName /SHORT $0 $INSTDIR
  StrCpy $INSTDIR $0
wwwwend:
StrLen $3 $TEMP
StrCpy $4 $EXEPATH $3
StrCmp $4 $TEMP 0 +3
 StrCpy $InstDir "C:\UCTO2015"
  GoTo instend
StrLen $3 $DESKTOP
StrCpy $4 $EXEPATH $3
StrCmp $4 $DESKTOP 0 +3
 StrCpy $InstDir "C:\UCTO2015"
  GoTo instend
StrLen $3 $WINDIR
StrCpy $4 $EXEPATH $3
StrCmp $4 $WINDIR 0 +3
 StrCpy $InstDir "C:\UCTO2015"
  GoTo instend
StrLen $3 $INTERNET_CACHE
StrCpy $4 $EXEPATH $3
StrCmp $4 $INTERNET_CACHE 0 +3
 StrCpy $InstDir "C:\UCTO2015"
  GoTo instend
StrLen $3 $PROFILE
StrCpy $4 $EXEPATH $3
StrCmp $4 $PROFILE 0 +3
 StrCpy $InstDir "C:\UCTO2015"
  GoTo instend
GetFullPathName /SHORT $3 $INSTDIR
GetFullPathName $4 $INSTDIR
StrCmp $4 $3 +2
 StrCpy $InstDir "C:\UCTO2015"
instend:
 GetFullPathName /SHORT $0 $INSTDIR
 StrCpy $INSTDIR $0
StrCpy $R9 "Instalace byla zruÜena u×ivatelem."
FunctionEnd
Name "$\"32 - Kurzy, prßce s cizÝmi mýnami$\""
Function .onVerifyInstDir
!insertmacro MUI_HEADER_TEXT "$\"32-Kurzy, prßce s cizÝmi mýnami$\" - vytvo°en dne 27.07.2015" "ę Zdenýk TrunýŔek - modul pro -Ŕto2015 firmy Tichř && spol. Novř Bor"
IfFileExists $INSTDIR\UFAND.EXE +1 ErrPathName
IfFileExists $INSTDIR\UCTO2015.CAT +1 ErrPathName
GetFullPathName /SHORT $9 $INSTDIR
GetFullPathName $8 $INSTDIR
StrCmp $9 $8 OkPathName
MessageBox MB_Ok "Vybranř adresß° obsahuje komponenty programu -Ŕto2015.$\n$\nToto -Ŕto ale nenÝ mo×no spouÜtýt, proto×e nßzev adresß°e nespl˛uje kriteria nezbytnß pro 16-bitovÚ systÚmy DOS."
ErrPathName:
Abort
OkPathName:
FunctionEnd
Page Directory
DirText "Nainstaluje modul $\"32 - Kurzy-cizÝ mýny$\" a spustÝ napojovßnÝ modulu na -Ŕto2015$\n$\nNenÝ-li p°ÝstupnÚ tlaŔÝtko $\"Instalovat$\", vyhledejte adresß°, kde se nachßzÝ -Ŕto  2015.$\nPro instalaci nelze vybrat adresß° nespl˛ujÝcÝ kriteria DOSu. (-Ŕto umÝstýnÚ v takovÚm adresß°i nelze spouÜtýt.)" "K vyhledßnÝ adresß°e pro instalaci pou×ijte tlaŔÝtko $\"Prochßzet$\""
Function .onInit
var /GLOBAL Ok64
Push "0"
Pop $Ok64
${if} $COMMONFILES64 != $COMMONFILES
Push "1"
Pop $Ok64
${endif}
 call .onGUIInit2
!insertmacro MULTIUSER_INIT
FunctionEnd
InstallDir $INSTDIR
Function StartMenuGroupSelect
!insertmacro MUI_HEADER_TEXT "$\"32-Kurzy, prßce s cizÝmi mýnami$\" - vytvo°en dne 27.07.2015" "ę Zdenýk TrunýŔek - modul pro -Ŕto2015 firmy Tichř && spol. Novř Bor"
MessageBox MB_YESNO "PokraŔovat instalacÝ modulu $\"32 - Kurzy-cizÝ mýny$\"" IDNO done IDYES success # use default
success:
        GoTo konec

done:
        Abort "Instalace byla p°edŔasný ukonŔena u×ivatelem"
Konec:
FunctionEnd

Function SpusteneUcto
IfFileExists $INSTDIR\FANDWORK.??? +1 +2
Delete $INSTDIR\FANDWORK.???
IfFileExists $INSTDIR\FANDWORK.??? +1 pokracuj3
MessageBox MB_RETRYCANCEL "-cto je asi spuÜtýno. $\n$\nPro pokraŔovßnÝ instalace je t°eba ukonŔit -Ŕto a pak pokraŔovat v instalaci" IDRETRY Cekej IDCANCEL Konci
Cekej:
  call SpusteneUcto
  GoTo pokracuj3
Konci:
      Abort "-Ŕto bylo spuÜtýno - instalace ukonŔena u×ivatelem"
pokracuj3:
FunctionEnd
Function .OnGUIEnd
 MessageBox MB_OK $R9
FunctionEnd

Page instfiles
VIProductVersion "2015.07.27.0"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "ProductName" "KURZY32.EXE "
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "ProductVersion" "modul pro -Ŕto 2015"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "Comments" "modul pro -Ŕto 2015"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "CompanyName" "Zdenýk TrunýŔek"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "Autor" "Zdenýk TrunýŔek"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "Publisher" "Zdenýk TrunýŔek"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "LegalTrademarks" "ę Zet-Ro-Zet"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "LegalCopyright" "ę Zdenýk TrunýŔek, Zet-Ro-Zet"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "FileDescription" "$\"32 - Kurzy-cizÝ mýny$\" pro -Ŕto 2015"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "FileVersion" "27.07.2015"
Section
 call StartMenuGroupSelect
        ifAbort skip pokracuj2
pokracuj2:
SetOutPath $INSTDIR
Call SpusteneUcto
ifAbort Skip
File /r "G:\I_U2015\INST_ZET\*.*"
${if} $Ok64 = "1"
GetFullPathName /SHORT $R9 $INSTDIR
FileOpen $0 $INSTDIR\{DBX1}\NSISZET.CFG w
FileWrite $0 "echo off"
FileClose $0
FileOpen $0 $INSTDIR\{DBX1}\NSISZET.CFG a
FileWrite $0 "echo off"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "CLS"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "IF EXIST $INSTDIR\{DBX1}\FANDWORK.$$$$$$ DEL $INSTDIR\{DBX1}\FANDWORK.$$$$$$"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "IF NOT EXIST $INSTDIR\{DBX1}\FANDWORK.$$$$$$ GOTO RUN"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "CLS"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "ECHO."
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "ECHO PROGRAM UCTO JIZ BEZI!"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "ECHO."
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "PAUSE"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "GOTO END"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "cls"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 ":RUN"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set instdbox=on"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandovrb=80"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandwork=$R9\{dbx1}\"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandcfg=$R9\{dbx1}\"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "$R9\{dbx1}\numlock.exe"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandres=$R9\"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "rescan /all"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
StrCpy $1 $R9 3
FileWrite $0 "cd $1"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
StrCpy $1 $R9 20 2
FileWrite $0 "cd $1"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "$R9\ufand.exe $R9\inst_zet.rdb"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandovrb="
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandwork="
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandcfg="
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandres="
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 ":END"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "EXIT"
FileClose $0
FileOpen $0 $INSTDIR\INST_Z64.BAT w
FileWrite $0 "echo off"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileClose $0
FileOpen $0 $INSTDIR\INST_Z64.BAT a
FileWrite $0 "echo off"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "if not exist STOP32.TXT GOTO NOSTOP"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "del STOP32.TXT > nul"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 ":NOSTOP"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "call {dbx1}\setdsk_i.bat"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "if exist {dbx2}\stop del {dbx2}\stop"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "if not exist {tisk}\winprc64.exe goto ubox"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "if not exist INST_ZET.BAT goto noinstbat"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "del INST_ZET.BAT > nul"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 ":noinstbat"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 ".\{tisk}\winprc64 -S=$\"{DBX1}\DOSBOX.EXE -exit -noconsole -conf {DBX1}\dosbox_z.cfg$\""
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "if not exist {DBX1}\NSISZET.CFG GOTO NONSISZET"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "del {DBX1}\NSISZET.CFG > nul"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 ":NONSISZET"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "if not exist INST_ZET.RDB GOTO NOINST_ZET"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "del INST_ZET.??? > nul"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "NOINST_ZET"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "GOTO END"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 ":UBOX"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "{tisk}\caller {tisk}\ubox $$ {dbx2} 1000 500 utisk04.exe"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "{tisk}\caller {dbx1}\dosbox.exe -noconsole -conf {dbx1}\dosbox_z.cfg"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 ":END"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileClose $0
FileWriteByte $0 "13"
FileWriteByte $0 "10"
ExecWait "$R9\INST_Z64.BAT"
${endif}
${if} $Ok64 = "0"
ClearErrors
GetFullPathName /SHORT $R9 $INSTDIR
FileOpen $0 $R9\INST_ZET.BAT w
FileClose $0
FileOpen $0 $R9\INST_ZET.BAT a
FileWrite $0 "mode con: cols=80 lines=25"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandovrb=80"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
StrCpy $1 $R9 3
FileWrite $0 "cd $1"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
StrCpy $1 $R9 20 3
FileWrite $0 "cd $1"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "$R9\UFAND.EXE $R9\INST_ZET.RDB"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "pause"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandovrb="
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandwork="
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandcfg="
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandres="
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileClose $0
IfFileExists $WINDIR\system32\cmd.exe +4 +1
Nop
ExecWait "$R9\INST_ZET.BAT"
GoTo +3
Nop
ExecWait "$R9\INST_ZET.BAT"
Nop
${endif}
IfFileExists $R9\STOP32.TXT 0 +3
StrCpy $R9 "Instalace modulu $\n$\"32-Kurzy, prßce s cizÝmi mýnami$\" (vytvo°enÚho dne 27.07.2015)$\n byla zruÜena u×ivatelem."
GoTo skip
Nop
${if} $Ok64 = "0"
IfFileExists $R9\INST_ZET.BAT 0 +3
StrCpy $R9 "[64] Instalace modulu $\n$\"32-Kurzy, prßce s cizÝmi mýnami$\" (vytvo°enÚho dne 27.07.2015)$\nse nezda°ila."
GoTo skip
Nop
${endif}
${if} $Ok64 = "1"
IfFileExists $INSTDIR\{DBX1}\FANDWORK.$$$$$$ 0 +3
StrCpy $R9 "[64] Instalace modulu $\n$\"32-Kurzy, prßce s cizÝmi mýnami$\" (vytvo°enÚho dne 27.07.2015)$\nse nezda°ila."
GoTo skip
Nop
${endif}
Nop
StrCpy $R9 "Instalace modulu $\n$\"32-Kurzy, prßce s cizÝmi mýnami$\" (vytvo°enÚho dne 27.07.2015)$\nbyla dokonŔena."
Delete $INSTDIR\INST_Z??.???
SetAutoClose true
skip:
quit
SectionEnd
What is the actual question that you have, and would like an answer for? Quote from: trikolka on July 27, 2015, 02:49:45 PM

I have installation files creation in NullSoft system 2.46.
(*.EXE files are storage in http://www.zetrozet.com/index.php?load=downtbl&modul=ucto15)

At starting from Windows 32-bit location, from Windows 64-bit location or from 16-bit location application below DosBox in Windows 64-bit location working totally correct.

At initiation from 16-bit location application in Windows 32-bit location working incorrect:
1) proper are unpacking insertion files
2) proper is generating and initiation batch-file
3) UFAND.EXE, that is to be initiation batch file, yet initiation isn't. Instead write out report "type 'exit' to return to FAND". (FAND.EXE, UFAND.EXE is 16-bit location programming language Czech rise.)

Last testing - if you run the setup * .exe from 16-bit applications running on 32-bit Windows under DOSBox will the entire installation correctly. Because * .EXE installer detects the 32-bit Windows from Windows 64-bit, 16-bit triggers application (UFAND.EXE) outside DOSBox.

Menu, from which the 16-bit application installation starts * .EXE (or downloaded from the web and then triggers):


For easier determination causes mistaken behaviour stoking NullSoft script, from that is of perceptible and way generation batch file
Code: [Select]!include MUI.nsh
; INST2015.nsi
; Tento skript nainstaluje INST2015.nsi do adresß°e, kterř si u×ivatel zvolÝ
;--------------------------------
!include MUI2.nsh
!define MUI_ABORTWARNING
!define Datum "27.07.2015"
!define DatumCas "27.07.2015 17:29"
!define Rok "2015"
!include MultiUser.nsh
!define MUI_UNICON "zetro20.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "welcome6.bmp"
!define MUI_HEADERIMAGE_BITMAP "header1.bmp"
!define MULTIUSER_EXECUTIONLEVEL Highest
!insertmacro MUI_PAGE_WELCOME
  !define MUI_TEXT_WELCOME_INFO_TITLE "VÝtejte v pr¨vodci instalacÝ programu$\r$\n$\t$(^NameDA)"
  !define MUI_TEXT_WELCOME_INFO_TEXT  "$\tP°ed zaŔßtkem instalace se doporuŔuje ukonŔit vÜechny ostatnÝ programy. TÝm umo×nÝte aktualizaci systÚmovřch soubor¨ bez pot°eby restartovßnÝ vaÜeho poŔÝtaŔe.$\r$\n$\r$\n$_CLICK$\r$\n$\r$\n$\r$\n$\r$\n$\r$\n$\r$\nVytvo°eno dne ${DatumCas}$\r$\n$\r$\nę Zdenýk TrunýŔek, Zet-Ro-Zet, BeneÜov nad PlouŔnicÝ"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!define MUI_FINISHPAGE_CANCEL_ENABLED true
!define MUI_FINISHPAGE_CANCEL_ENABLED_VARIABLES true
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!define MUI_FINISHUNPAGE_CANCEL_ENABLED true
!define MUI_FINISHUNPAGE_CANCEL_ENABLED_VARIABLES true
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_LANGUAGE "Czech_www"
!include FileFunc.nsh
!include WordFunc.nsh
!include WinMessages.nsh
!insertmacro WordReplace
!insertmacro Un.WordReplace
var /GLOBAL outfile
BGGradient 0088FF 663366 notext
BrandingText /TRIMRIGHT "ę Zdenýk TrunýŔek Zet-Ro-Zet, BeneÜov nad PlouŔnicÝ"
RequestExecutionLevel highest
XPStyle on
AllowRootDirInstall false
Icon "G:\I_U2015\{tisk}\zetro20.ico"
OutFile KURZY32.EXE
Function .onGUIInit2
${GetExeName} $R0
${GetExePath} $R1
StrLen $R3 $R1
StrCpy $R1 $R0 -$R3
StrCpy $outfile $R1 "" 1
StrLen $1 $outfile
StrCpy $0 $EXEPATH -$1
StrCpy $0 $0 -1
StrCpy $2 $0 "" -6
StrCmp $2 "{wwww}" wwww nowwww
 wwww:
  StrCpy $InstDir $0 -7
  GetFullPathName /SHORT $0 $INSTDIR
  StrCpy $INSTDIR $0
  goto wwwwend
nowwww:
  GetFullPathName /SHORT $0 $INSTDIR
  StrCpy $INSTDIR $0
wwwwend:
StrLen $3 $TEMP
StrCpy $4 $EXEPATH $3
StrCmp $4 $TEMP 0 +3
 StrCpy $InstDir "C:\UCTO2015"
  GoTo instend
StrLen $3 $DESKTOP
StrCpy $4 $EXEPATH $3
StrCmp $4 $DESKTOP 0 +3
 StrCpy $InstDir "C:\UCTO2015"
  GoTo instend
StrLen $3 $WINDIR
StrCpy $4 $EXEPATH $3
StrCmp $4 $WINDIR 0 +3
 StrCpy $InstDir "C:\UCTO2015"
  GoTo instend
StrLen $3 $INTERNET_CACHE
StrCpy $4 $EXEPATH $3
StrCmp $4 $INTERNET_CACHE 0 +3
 StrCpy $InstDir "C:\UCTO2015"
  GoTo instend
StrLen $3 $PROFILE
StrCpy $4 $EXEPATH $3
StrCmp $4 $PROFILE 0 +3
 StrCpy $InstDir "C:\UCTO2015"
  GoTo instend
GetFullPathName /SHORT $3 $INSTDIR
GetFullPathName $4 $INSTDIR
StrCmp $4 $3 +2
 StrCpy $InstDir "C:\UCTO2015"
instend:
 GetFullPathName /SHORT $0 $INSTDIR
 StrCpy $INSTDIR $0
StrCpy $R9 "Instalace byla zruÜena u×ivatelem."
FunctionEnd
Name "$\"32 - Kurzy, prßce s cizÝmi mýnami$\""
Function .onVerifyInstDir
!insertmacro MUI_HEADER_TEXT "$\"32-Kurzy, prßce s cizÝmi mýnami$\" - vytvo°en dne 27.07.2015" "ę Zdenýk TrunýŔek - modul pro -Ŕto2015 firmy Tichř && spol. Novř Bor"
IfFileExists $INSTDIR\UFAND.EXE +1 ErrPathName
IfFileExists $INSTDIR\UCTO2015.CAT +1 ErrPathName
GetFullPathName /SHORT $9 $INSTDIR
GetFullPathName $8 $INSTDIR
StrCmp $9 $8 OkPathName
MessageBox MB_Ok "Vybranř adresß° obsahuje komponenty programu -Ŕto2015.$\n$\nToto -Ŕto ale nenÝ mo×no spouÜtýt, proto×e nßzev adresß°e nespl˛uje kriteria nezbytnß pro 16-bitovÚ systÚmy DOS."
ErrPathName:
Abort
OkPathName:
FunctionEnd
Page Directory
DirText "Nainstaluje modul $\"32 - Kurzy-cizÝ mýny$\" a spustÝ napojovßnÝ modulu na -Ŕto2015$\n$\nNenÝ-li p°ÝstupnÚ tlaŔÝtko $\"Instalovat$\", vyhledejte adresß°, kde se nachßzÝ -Ŕto  2015.$\nPro instalaci nelze vybrat adresß° nespl˛ujÝcÝ kriteria DOSu. (-Ŕto umÝstýnÚ v takovÚm adresß°i nelze spouÜtýt.)" "K vyhledßnÝ adresß°e pro instalaci pou×ijte tlaŔÝtko $\"Prochßzet$\""
Function .onInit
var /GLOBAL Ok64
Push "0"
Pop $Ok64
${if} $COMMONFILES64 != $COMMONFILES
Push "1"
Pop $Ok64
${endif}
 call .onGUIInit2
!insertmacro MULTIUSER_INIT
FunctionEnd
InstallDir $INSTDIR
Function StartMenuGroupSelect
!insertmacro MUI_HEADER_TEXT "$\"32-Kurzy, prßce s cizÝmi mýnami$\" - vytvo°en dne 27.07.2015" "ę Zdenýk TrunýŔek - modul pro -Ŕto2015 firmy Tichř && spol. Novř Bor"
MessageBox MB_YESNO "PokraŔovat instalacÝ modulu $\"32 - Kurzy-cizÝ mýny$\"" IDNO done IDYES success # use default
success:
        GoTo konec

done:
        Abort "Instalace byla p°edŔasný ukonŔena u×ivatelem"
Konec:
FunctionEnd

Function SpusteneUcto
IfFileExists $INSTDIR\FANDWORK.??? +1 +2
Delete $INSTDIR\FANDWORK.???
IfFileExists $INSTDIR\FANDWORK.??? +1 pokracuj3
MessageBox MB_RETRYCANCEL "-cto je asi spuÜtýno. $\n$\nPro pokraŔovßnÝ instalace je t°eba ukonŔit -Ŕto a pak pokraŔovat v instalaci" IDRETRY Cekej IDCANCEL Konci
Cekej:
  call SpusteneUcto
  GoTo pokracuj3
Konci:
      Abort "-Ŕto bylo spuÜtýno - instalace ukonŔena u×ivatelem"
pokracuj3:
FunctionEnd
Function .OnGUIEnd
 MessageBox MB_OK $R9
FunctionEnd

Page instfiles
VIProductVersion "2015.07.27.0"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "ProductName" "KURZY32.EXE "
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "ProductVersion" "modul pro -Ŕto 2015"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "Comments" "modul pro -Ŕto 2015"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "CompanyName" "Zdenýk TrunýŔek"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "Autor" "Zdenýk TrunýŔek"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "Publisher" "Zdenýk TrunýŔek"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "LegalTrademarks" "ę Zet-Ro-Zet"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "LegalCopyright" "ę Zdenýk TrunýŔek, Zet-Ro-Zet"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "FileDescription" "$\"32 - Kurzy-cizÝ mýny$\" pro -Ŕto 2015"
VIAddVersionKey /LANG=${LANG_CZECH_WWW} "FileVersion" "27.07.2015"
Section
 call StartMenuGroupSelect
        ifAbort skip pokracuj2
pokracuj2:
SetOutPath $INSTDIR
Call SpusteneUcto
ifAbort Skip
File /r "G:\I_U2015\INST_ZET\*.*"
${if} $Ok64 = "1"
GetFullPathName /SHORT $R9 $INSTDIR
FileOpen $0 $INSTDIR\{DBX1}\NSISZET.CFG w
FileWrite $0 "echo off"
FileClose $0
FileOpen $0 $INSTDIR\{DBX1}\NSISZET.CFG a
FileWrite $0 "echo off"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "cls"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "IF EXIST $INSTDIR\{DBX1}\FANDWORK.$$$$$$ DEL $INSTDIR\{DBX1}\FANDWORK.$$$$$$"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "IF NOT EXIST $INSTDIR\{DBX1}\FANDWORK.$$$$$$ GOTO RUN"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "CLS"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "ECHO."
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "ECHO PROGRAM UCTO JIZ BEZI!"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "ECHO."
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "PAUSE"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "GOTO END"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "cls"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 ":RUN"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set instdbox=on"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandovrb=80"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandwork=$R9\{dbx1}\"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandcfg=$R9\{dbx1}\"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "$R9\{dbx1}\numlock.exe"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandres=$R9\"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "rescan /all"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
StrCpy $1 $R9 3
FileWrite $0 "cd $1"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
StrCpy $1 $R9 20 2
FileWrite $0 "cd $1"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "$R9\ufand.exe $R9\inst_zet.rdb"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandovrb="
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandwork="
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandcfg="
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandres="
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 ":END"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "EXIT"
FileClose $0
FileOpen $0 $INSTDIR\INST_Z64.BAT w
FileWrite $0 "echo off"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileClose $0
FileOpen $0 $INSTDIR\INST_Z64.BAT a
FileWrite $0 "echo off"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "if not exist STOP32.TXT GOTO NOSTOP"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "del STOP32.TXT > nul"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 ":NOSTOP"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "call {dbx1}\setdsk_i.bat"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "if exist {dbx2}\stop del {dbx2}\stop"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "if not exist {tisk}\winprc64.exe goto ubox"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "if not exist INST_ZET.BAT goto noinstbat"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "del INST_ZET.BAT > nul"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 ":noinstbat"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 ".\{tisk}\winprc64 -S=$\"{DBX1}\DOSBOX.EXE -exit -noconsole -conf {DBX1}\dosbox_z.cfg$\""
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "if not exist {DBX1}\NSISZET.CFG GOTO NONSISZET"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "del {DBX1}\NSISZET.CFG > nul"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 ":NONSISZET"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "if not exist INST_ZET.RDB GOTO NOINST_ZET"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "del INST_ZET.??? > nul"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "NOINST_ZET"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "GOTO END"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 ":UBOX"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "{tisk}\caller {tisk}\ubox $$ {dbx2} 1000 500 utisk04.exe"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "{tisk}\caller {dbx1}\dosbox.exe -noconsole -conf {dbx1}\dosbox_z.cfg"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 ":END"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileClose $0
FileWriteByte $0 "13"
FileWriteByte $0 "10"
ExecWait "$R9\INST_Z64.BAT"
${endif}
${if} $Ok64 = "0"
ClearErrors
GetFullPathName /SHORT $R9 $INSTDIR
FileOpen $0 $R9\INST_ZET.BAT w
FileClose $0
FileOpen $0 $R9\INST_ZET.BAT a
FileWrite $0 "mode con: cols=80 lines=25"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandovrb=80"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
StrCpy $1 $R9 3
FileWrite $0 "cd $1"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
StrCpy $1 $R9 20 3
FileWrite $0 "cd $1"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "$R9\UFAND.EXE $R9\INST_ZET.RDB"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "pause"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandovrb="
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandwork="
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandcfg="
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileWrite $0 "set fandres="
FileWriteByte $0 "13"
FileWriteByte $0 "10"
FileClose $0
IfFileExists $WINDIR\system32\cmd.exe +4 +1
Nop
ExecWait "$R9\INST_ZET.BAT"
GoTo +3
Nop
ExecWait "$R9\INST_ZET.BAT"
Nop
${endif}
IfFileExists $R9\STOP32.TXT 0 +3
StrCpy $R9 "Instalace modulu $\n$\"32-Kurzy, prßce s cizÝmi mýnami$\" (vytvo°enÚho dne 27.07.2015)$\n byla zruÜena u×ivatelem."
GoTo skip
Nop
${if} $Ok64 = "0"
IfFileExists $R9\INST_ZET.BAT 0 +3
StrCpy $R9 "[64] Instalace modulu $\n$\"32-Kurzy, prßce s cizÝmi mýnami$\" (vytvo°enÚho dne 27.07.2015)$\nse nezda°ila."
GoTo skip
Nop
${endif}
${if} $Ok64 = "1"
IfFileExists $INSTDIR\{DBX1}\FANDWORK.$$$$$$ 0 +3
StrCpy $R9 "[64] Instalace modulu $\n$\"32-Kurzy, prßce s cizÝmi mýnami$\" (vytvo°enÚho dne 27.07.2015)$\nse nezda°ila."
GoTo skip
Nop
${endif}
Nop
StrCpy $R9 "Instalace modulu $\n$\"32-Kurzy, prßce s cizÝmi mýnami$\" (vytvo°enÚho dne 27.07.2015)$\nbyla dokonŔena."
Delete $INSTDIR\INST_Z??.???
SetAutoClose true
skip:
quit
SectionEnd

[attachment deleted by admin to conserve space] Quote from: foxidrive on July 28, 2015, 01:14:25 AM
What is the actual question that you have, and would like an answer for?
Question - why when you start the installation of 16-bit applications running on Windows 32-bit installation does not correctly. Quote from: trikolka on July 28, 2015, 01:31:06 AM
Question - why when you start the installation of 16-bit applications running on Windows 32-bit installation does not correctly.

To repeat the problem, you have a 16 bit application and it is not installing properly on a 32 bit version of windows.

What happens that is wrong when you install it in a 32 bit Windows? 
You SAID that there is a prompt on the screen - is a batch file running and the batch file is not doing the right thing?

Or is the problem in the NullSoft script?

In your screenshot you are showing Dosbox, and I don't see how that ties in with the question.1) When the update * .EXE running on 32-bit Windows, from Windows 64-bit or 16-bit application under DOSBox is working quite correctly. (When you start a Windows 64-bit, you start a 16-bit installer under DOSBox)

2) When the update * .EXE running on the same 16-bit applications under Windows 32-bit, will be a correct unpack the attached file is executed correctly generated * .BAT file, but instead run the 16-bit update program (UFAND.EXE) batch issues souvor message "type 'exit' to return to Fand".

3) NullSoft script is included because it includes creating batch files to run under DOSBox or outside of DOSBox.

4) Picture illustrates that the choice of 16-bit applications update file is called and executed. Is the same if 16-bit applications running under DOSBox or under Ntvdm Windows 32-bit.














1) When the update * .EXE running on 32-bit Windows, from Windows 64-bit or 16-bit application under DOSBox is working quite correctly. (When you start a Windows 64-bit, you start a 16-bit installer under DOSBox)

2) When the update * .EXE running on the same 16-bit applications under Windows 32-bit, will be a correct unpack the attached file is executed correctly generated * .BAT file, but instead run the 16-bit update program (UFAND.EXE) batch issues souvor message "type 'exit' to return to Fand".

3) NullSoft script is included because it includes creating batch files to run under DOSBox or outside of DOSBox.

4) Picture illustrates that the choice of 16-bit applications update file is called and executed. Is the same if 16-bit applications running under DOSBox or under Ntvdm Windows 32-bit.

5) If you want to test the behavior of the program is:
   a) the need to install software from u15_cd.exe www.ucto2000.cz/download.htm (as a demo without requiring a license).
   b) install the program from an external MODULE www.zetrozet.com/index.php?load=downtbl&modul=ucto15 example KURZY32.EXE (license data must be filled, you can enter any nonsense).
   c) then you can try the difference behavior when updating an external module running KURZY32.EXE of Windows 32-bit or by calling the open program option according to the previously inserted picture.
   d) If the program runs with U64.BAT place U.BAT, will be in 32-bit Windows running under DOSBox. In this case, the updated external module is updated correctly.
   (The program is designed to tax records according to Czech law, because it is only in Czech.) Quote from: trikolka on July 28, 2015, 06:46:14 AM
2) When the update * .EXE running on the same 16-bit applications under Windows 32-bit, will be a correct unpack the attached file is executed correctly generated * .BAT file, but instead run the 16-bit update program (UFAND.EXE) batch issues souvor message "type 'exit' to return to Fand".

I understand that your mother tongue is not English, but you have included several things that confuse the question.


  • You are using Dosbox somehow and not just Windows 32 bit
  • You're including some kind of file manager by the look of it, as the message type 'exit' to return to Fand usually indicates that a file manager shell is running.
  • There is the Nullsoft aspect and a batch script, and we'd need to see the batch script.
1) The error occurs only when you run the update file from 16-bit applications on 32-bit Windows.

2) batch file for Windows 32-bit attach, it generates an installer according to user-selected directory. Because of the search for the cause was tried, the error manifests itself in exactly the same way, even if the row triggering UFAND.EXE not specify parameter. The procedure of generating the batch file is written line by line in the previously attached NullSoft script.

Code: [Select]mode con: cols=80 lines=25
set fandovrb=80
set fandwork=D:\OVER2015\
set fandcfg=D:\OVER2015\
set fandres=D:\OVER2015\
cd D:\
cd OVER2015
D:\OVER2015\UFAND.EXE D:\OVER2015\INST_ZET.RDB
set fandovrb=
set fandwork=
set fandcfg=
set fandres=

3) Users installer sets accounting program run under DOSBox only in 64-bit Windows. Use DOSBox in Windows 32-bit installer program does not adjust. I myself run a program under DOSBox used solely for the purpose of testing the conditions under which the error occurs.

I apologize for the English, I learned it only half a year in 1968, so now I use different compiler.This will solve a problem when the target folder contains a space or an & character etc and simplifies it a little
but if you are using non-latin characters then that can be an issue as the codepage may need to be changed.

It assumes that UFAND.EXE is capable of using long filenames

Code: [Select]mode con: cols=80 lines=25
set "fandovrb=80"
set "folder=D:\OVER2015\"
for %%a in (fandwork fandcfg fandres) do set "%%a=%folder%"
cd /d "%folder%"
UFAND.EXE "%folder%\INST_ZET.RDB"
for %%a in (fandwork fandcfg fandres fandovrb) do set "%%a="

Your problem can be in the Nullsoft script, which is not short and simple and I'm not familiar with the scripting language so somebody else may check that for you,

Or it could be in the UFAND.EXE program and it fails in some way, when used in the way you are using it.

and your use of Dosbox is complicating this - as the exact environment this is task is being run in is not clear.
Quote
1) When the update * .EXE running on 32-bit Windows, from Windows 64-bit or 16-bit application under DOSBox is working quite correctly. (When you start a Windows 64-bit, you start a 16-bit installer under DOSBox)
I do not think the above e is w an accurate statement,  nor does it represent areal problem in the real world.

It is not just my opinion, but the advice if many others that 16 bit program should not run on a MODERN computer if it can be avoided.

Commercial and Industrial users who depend on 16 bit programs buy older equipment and maintain it for use on their in-house projects. This is more cost-effective.

To illustrate. An experienced tech can assembly a legacy computer for old or surplus materials inside of a week.  But a good programmer could spend weeks trying to GET  an legacy 16 bit program to work  a modern computer. 
legacy computers:
http://www.makeuseof.com/tag/3-online-sources-finding-buying-computer-parts/
1) I can not pick and choose which computer users will run the accounting program, the ten million Czech Republic it is still used by tens of thousands of accounts. I just am creating this program, additional modules and the authors of that accounting software to interact leave.

2) The attached NullSoft script contains the installation in Windows 32-bit control directories and convert them to DOS-names.

3) When searching for the cause of the error has been tested as a batch file, which contained the single word "UFAND". The result was the same - when starting from the choice of accounting software in Windows 32-bit error, when other methods of lowering correct commissioning.There is a massive language barrier that I doubt will be particularly easy to permeate here.Your proposed text batch file was successful.

[attachment deleted by admin to conserve space]If choosing the 16-bit program, download the installer from the web-site and choosing the 16-bit program, then run crashes shown attached picture.
If the setup option in 16-bit only download a program, but run from explorer or Totalcommnder held the entire installation correctly.
The batch file generated NullSoft script in both cases is absolutely identical.
NullSoft script checks the 16-bit program and batch file starts to generate up if the program is ended.
1062.

Solve : Program?

Answer»

Dear all,

could you HELP me to FIND PROGRAM better than( E-BatchMaker )write the batches and convert to exe and drag an icon to BATCH or some thing LIKE that.Look here: http://www.f2ko.de/en/index.php

1063.

Solve : I need to call a success or fail after a program finishes installing?

Answer»

is it possible to call a success or fail after installing a program from the .bat file?  Here is a sample of what I have so far:


echo off
echo Installing Random Filename
call random file name




Is there a WAY to have it report success or fail for that random filename installation?The program you are CALLING would have to set an error level after installing.  At which point you can then use the %errorlevel% variable to determine success or failure. How could I determine if a specifc program would set an error CODE? Is it program specific? I will be using this to call more than one prigrma for installation if that helps any.Well I could think of two logical ways to determine that.
1) Run the program from the batch file and then echo the errorlevel variable to the screen.
2) Read the manual for the program!OK, thanks

1064.

Solve : BAT file to open remote folders?

Answer»

Hey all

Is it possible to make a batch file that would do this?:

User launches BAT file
User inputs 4 digit number which refers to a remote PC's location
BAT file figures out the remote computers IP address (lets say for example there's a PC located at 1234, its IP address would be 40.12.34.20 (the PC would ALWAYS be on .20 and the first part of the IP is always PRESET to 40.)
Once connected it will input the remote PC's admin credentials for access
It will then open up the root of C: allowing the user to drop files into it.

Hope this makes sense! HARD to explain...

Thanks The task isn't too clear but UIAM the root of the system drive c: doesn't allow users to write files there.

The second and third octecs of the IP address can also have other than 2 numerals.

So you are trying to do this across the Internet?  Because the IP address you gave US is not a reserved (Private) IP address. This causes a whole bunch of other HEADACHES if that is what you are trying to do.  Not too mention I doubt we would be able to determine the IP address without some type of DNS resolution.

1065.

Solve : orginizing my swf files?

Answer»

i want to unzip my swf files in the root and then move them into there own directory in games folder. there is over 1000 of them its TAKING to long to do this manually on my lan. i would like to USE a .bat to do this. its been a while that i have tried doing my own batch files.
each file has its own name and i would like to use that name for its folder. then clean up the files once the work is done so i can have a clean root directory.

d:\                               this is were the batch file , zip files and swf files are.
d:\games                      flash game folder
d:\games\age of war      own game folder for swf file

d:\age of war.zip
or
d:\age of war.swf




win10 HOME edition 64 bitWhat console zip PROGRAM are you using?7zip

1066.

Solve : "Setup" not listed in help command??

Answer»

There appears to be a command, or .exe file, called "setup." It works when I type "setup" in MS-DOS (6.22), but when I type in "help," I don't SEE it listed there. Does anyone have any idea why it's not listed? Or am I LOOKING in the wrong spot? I just don't understand why it wouldn't be listed...It's not listed because it is not PART of MS-DOS.

Windows 3.1 includes a setup program for configuring the system. Earlier versions had SOMETHING similar, I believe. That is likely what you are launching.That's good advice you got there.  setup.exe can be an install file too.

The help in MSDOS V6.22 only SHOWS system commands - internal and external commands.

If you type setup /? then you may see some switches on the internal help that would be useful, but not all setup.exe have internal help.

1067.

Solve : Windows 1.04 freezing and not working?

Answer»

When I try and press enter on something, it won't work. After I move the arrow keys around and try a couple more times it freezes. How do I fix this? I'm USING VMWare Fusion 7 and MS-DOS 6.22.Have you checked into this info here?: https://communities.vmware.com/thread/93983?tstart=0 Quote from: DaveLembke on July 21, 2016, 08:05:32 AM

Have you checked into this info here?: https://communities.vmware.com/thread/93983?tstart=0
Thank you very much!

For anyone else having this problem, it was MS-DOS 6.22. MS-DOS 5.0 works fine. I don't know why... Maybe 6.22 is incompatible with 1.0? Quote from: Jacob42 on July 21, 2016, 01:03:53 PM
Thank you very much!

For anyone else having this problem, it was MS-DOS 6.22. MS-DOS 5.0 works fine. I don't know why... Maybe 6.22 is incompatible with 1.0?
Isn't that what that thread was basically saying.  Windows 1 was originally created to run on top of MS-DOS 2. Quote from: Squashman on July 21, 2016, 01:17:39 PM
Isn't that what that thread was basically saying.  Windows 1 was originally created to run on top of MS-DOS 2.

Yeah, I'm a little amused that you're using MSDOS of a far later period to run Windows of that vintage.

I haven't TRIED it myself mind you, but I would have expected EVEN MSDOS 5 to break many aspects of Win 1
1068.

Solve : gwbasic writing to a file in a different directory.?

Answer»

i am re using one of my old gwbasic files but it save/writes to the wrong directory/folder

COULD someone tell me the line to write to the correct directory.      e.g. c:form\fred

i use it on 32 bit vista .



OPEN "B:TEMP" FOR INPUT AS #1



it is writing my file to the windows directory system32 and i am unable to set up a short CUT to this and have to look for it and it takes too long.  i need the file to write to a normal folder so that i can put a shortcut and to read the output quickly.
Quote from: topsy99 on August 05, 2016, 10:28:01 PM

i am re using one of my old gwbasic files but it save/writes to the wrong directory/folder

OPEN "B:TEMP" FOR INPUT AS #1

it is writing my file to the windows directory system32

The line above is a file your BASIC program is reading from, not saving to.


Right click and open the properties of your shortcut.
Look for a box with the name "Start in:"

Type the path you want your file saved to in that box.  Save and test that.  Don't make any typing errors.

That may or may not work - it depends on the script and aspects of your computer.i cant quote the actual line e.g. opening or writing as i am on a windows 10 computer at present away from home and cant replicate the line.

the file is on this computer but windows says cant read due to this being 64 bit.

will try your solution when i get home.

thanksin further explanation.  My gwbasic comes up on a shortcut.   i then run the gwbasic file     it then saves to a txt file.    but i want the txt file to save in a different directory.       assume.     fred to be the current directory   i want it to save to c:\harry   how do i tell it in the open file line.

Quote
assume.     fred to be the current directory   i want it to save to c:\harry   how do i tell it in the open file line.

Enter the full path.

Code: [SELECT]OPEN "C:\harry\file.txt" FOR OUTPUT AS #1
1069.

Solve : split 1 folder with 160.000 files in 8 different folders with 20.000 files per f?

Answer»

currently i have the specific files (160.000) in 1 folder which is named ''PL''

I want to split the files in 8 different folders (named: stream1, stream2,..,stream which contain 20.000 files each.

within those folders i have 3 subfolders called ''set1, set2, set3) where i want to split the 20.000 files in 3.

is there a possibility to create an easy script where i can MOVE those 160.000 files in 8 folders, and eventually those 20.000 each in 3 subfolders?[/color]


Would be great if you could help me.

MAny thanks from a noob from holland Is this homework or a real world thing?

Make it more simple. Do it incrementally.

Write a batch that with move the first 20,000 files.
when it is DONE... wait a bit. The do it gain.
Use a pencil and paper to keep TRACK of how many times.
Stop after you haw done it 8 times.
CHECK and see if the fold is now empty.

That s after than TRYING to figure out how to make it faster.


1070.

Solve : Marking folders for encryption services in DOS?

Answer»

I can create a new folder in DOS with the following command:

mkdir F:\test\

How, in DOS, do I make it so that the folder, and any future contents, are encrypted?

Thanks in advance.If you MEAN MS-DOS, you can't.

If you mean the Windows Command Line, you can use "Cipher" on versions/Editions of windows that support NTFS file encryption to encrypt or DECRYPT files based on your user SID. You could always set it as read-only with this:

ATTRIB +r "path to folder" /S

As for proper encryption, I have heard Cipher.exe is the command-line encryption TOOL. Cipher.exe was included in all releases of Windows XP and in Windows 2000 SP3 onward.

1071.

Solve : Extract contents from a string?

Answer»

I have a variable string that looks like the following:
            Code: [Select]SET VAR1="could be anything++++something+anything can follow+something+something"How do I EXTRACT everything from the "++++" to the end of the string?  In this case, my RESULT would be:  ++++something+anything can follow+something+something.
The string is not fixed in size, the key is extracting everything from ++++ to the end of the string.

I did the following, but then that is cheating:
          Code: [Select]SET VAR2=%VAR1:*++++="++++%Is the separator between sections always 4 plus signs?

Is it always the first occurrence in the string of that character?The 4 plus signs may or may not appear in a string.  In my script, I do test for 4 plus signs before continuing else I will exit.
If the 4 plus signs does appear, I WANT to extract everything from the 4 plus signs until the end of the string.If a string does not contain 4 plus signs, it is ignored?

If a string does contain 4 plus signs, are they the first occurence of plus signs in the string?

Do you want any later plus signs to remain?


If a string does not contain 4 plus signs, it is ignored?    Yes, it is ignored if there are not 4 plus signs.

If a string does contain 4 plus signs, are they the first occurence of plus signs in the string?  Anything can precede the 4 plus signs, I am interested only in the contents from the start of the 4 plus signs to the very end of the string.

Do you want any later plus signs to remain?  All plus signs must remain, see below:.

If the string is:                                "could be anything++++something+anything can follow+something+something"
I want the following returned:        "++++something+anything can follow+something+something"You can use FOR /F to split the string into two halves, the part before ++++ and the part after, and then PUT back the ++++.

echo off
SET VAR1="could be anything++++something+anything can follow+something+something"
for /f "tokens=1* delims=+" %%A in (%var1%) do (
    set firstpart=%%A
    set lastpart=++++%%B
   )
echo whole string %var1%
echo first part   %firstpart%
echo last  part   %lastpart%
echo.
pause

Output...

C:\Batch\Test>test1.bat
whole string "could be anything++++something+anything can follow+something+something"
first part   could be anything
last  part   ++++something+anything can follow+something+something

Press any key to continue . . .


Works like a charm, thank you very much.....

1072.

Solve : Copying specific files across the network?

Answer»

Dear All,

kindly explain how to copying specific files across the network from machine to another machine
 i tried to USING xcopy command with some parameters to do that but i found my batch didn't work properly
, So can any one here to expalin where is my mistake
and write the true command according to my environment as i attached my Bat file here
And i want to copy whole (Atb firmware )folder from on C: root partition and it's content into three files to destination C: root on network machine, i mean i want to create the same folder on destination machine and copy the three files into it in one Bat file order.
Note: I Won't to compress this folder then copy it.

Hope to all my best wishes

[attachment deleted by admin to conserve space]For more explain .
i want to create a folder if doesn't exist then copy files into it on the network machine and if the folder exist and content a files also i want to overwrite on itAbo-Zead,
Please do not send BAT files to the forum.
Also, sending any thing to the root of the C: drive is a bad practice.
Instead, each workstation should have a directory shared with write permission.
You called your batch file xcopy.bat

Use a different name for your script: because the xcopy command inside it will re-launch your batch script instead of using the xcopy.exe command. Quote from: foxidrive on September 12, 2016, 03:47:36 PM

You called your batch file xcopy.bat

Use a different name for your script: because the xcopy command inside it will re-launch your batch script instead of using the xcopy.exe command.
If I had a dollar for every time someone named their batch file the same as a command in their batch file, I would be a little bit wealthier.  Maybe middle class instead of lower middle class. Quote from: Squashman on September 14, 2016, 12:38:10 PM
If I had a dollar for every time someone named their batch file the same as a command in their batch file, I would be a little bit wealthier.  Maybe middle class instead of lower middle class.

That's the way to riches!  I should charge people for the advice. 

A PROBLEM that many of those people will not follow is when the batch file is called using a full path and not in the current directory.    It will work then and they will think "Gee, that guy doesn't know the FIRST thing about batch files".
1073.

Solve : rename "%%~nG.xml" "%%~nG.ts" doesn't work?

Answer»

I want to change the FILENAME of all files in a folder where no TS file exist into XML file
For example: when the file test.xml EXISTS and the file test.ts doesn't exist I want to rename the file test.xml to test.ts
I tried this batch but it doesn't work. The batch do nothing.

FOR %%G in (*.xml) do if not exist "%%~nG.ts" rename "%%~nG.xml" "%%~nG.ts"

Any ideas?Try RUNNING this and see what messages you MAY get

echo off
FOR %%G in (*.xml) do (
    echo Found: "%%~nG.xml"
    if not exist "%%~nG.ts" (
       echo "%%~nG.ts" does not exist
       echo Trying to rename "%%~nG.xml" to "%%~nG.ts"
       rename "%%~nG.xml" "%%~nG.ts" && (echo Success) || (echo Fail)
   ) else (
       echo "%%~nG.ts" ALREADY exists
   )
)
echo Finished
pause

1074.

Solve : On Screen Qwerty Keyboard for MS-DOS?

Answer»

Hi,

I'm looking for an on-screen qwerty keyboard for DOS. (Not DOS apps running in windows) That a user can mouse click the on screen keys so the keystrokes can be fed into an application just as a regular fixed keyboard would do. Would anyone know if there is an application available?

Thanks None available that i can think of. If you know of a good programmer they could make this for you however mouse controls might have to be serial COM1 or COM2 or PS2 mouse port. Finding USB Serial programming for DOS without windows is a stretch. Additionally it likely would not be pretty looking in 16-bit.

I have serious doubts that you will be ABLE to do away with the keyboard completely.

 What kind of programs do you want to pass the keystrokes to?

  Someone might be able to write a TSR that could be called by hot key combination like CTRL+K to bring up the GUI keyboard and upon hitting enter it passes the key stream to the application simulating keystrokes and vanishes. Until CTRL+K again. The biggest issue is that whatever our passing keystrokes to via a GUI INTERFACE will need to be the focus, be running when the key stream is sent. So the application you want to run wouldnt be running, you would say CTRL+K to tell the TSR to bring up the GUI interface keyboard, click what you want to pass to it and it stores the keyboard stream,  and then launch the application, and then either a time delay to where it passes the keyboard stream or another hot key combination like CTRL+S to send the keystroke stream to the application through SIMULATED keystrokes. But then your getting into Keyboard Macros. There are keyboard macros out there for DOS, but they are constructed using keyboard and not a GUI point and click.

This is above is beyond my programming skills, but thinking of how it could be constructed and work in a completely only DOS environment. I feel a TSR is the only way to have this GUI Keyboard where its like a service waiting for the keystroke of say CTRL+K to bring up the keyboard and then it stores what is to be typed and passes it LATER when the application is launched later to that application.

TSR's generally run behind the SCENES in memory to hack, modify, or perform some sort of background service to a DOS environment. ( the virus's and hacking of the day were in this TSR category ). So Im thinking this is the only way to make this happen. Will be interesting if you find a method that works.

 If you had Windows running such as Windows 3.11 you would be more apt to have multitasking and a nicer looking GUI keyboard than what DOS can provide.

Thinking deeper 2 computers could be used via a serial null cable and one computer is always up with the mouse GUI and passing serial stream of keystrokes to the 2nd computer which would act like normal but be receiving instructions from the other in a remote control keystroke way through the GUI of the 2nd computer to the first. The first computer would have a TSR listener service running that accepts all keystrokes over serial communications. This I can see working much better than a single computer with only DOS as the OS. The first computer would need a line added to config.sys or autoexec.bat for the TSR to load to RAM on boot. You would be likely running into a very very tight memory band where you have to worry about using too much base memory of the 640k to which DOS programs wont run if too much base memory is in use. himem.sys might help, but its quite a project you have.

1075.

Solve : Extract specific filename from a text file into a new text file?

Answer»

Hi all,

Input text filename : abc.txt
OUTPUT text filename : abc-out.txt

Inside abc.txt

connect

connection established; transferring PDF123456-qwe.sts
Received PDF123456-qwe.sts

connection established; transferring PDF223456-qwe.sts
Received PDF223456-qwe.sts

connection established; transferring PDF128456-qwe.sts
Received PDF128456-qwe.sts

Connection stopped

Expected Output
Inside of abc-out.txt

PDF123456-qwe.sts
PDF223456-qwe.sts
PDF128456-qwe.sts

I tried using

findstr /i "PDF" abc.txt > abc-out.txt

but I get the following which not really what I want

connection established; transferring PDF123456-qwe.sts
Received PDF123456-qwe.sts
connection established; transferring PDF223456-qwe.sts
Received PDF223456-qwe.sts
connection established; transferring PDF128456-qwe.sts
Received PDF128456-qwe.sts

Thanks for the help in advanceSorry guys... edited output as follows

Expected Output
Inside of abc-out.txt

123456-qwe.sts
223456-qwe.sts
128456-qwe.sts Code: [Select]echo off
FOR /F "tokens=1* delims= " %%G IN ('find /I "received pdf" ^<abc.txt') DO (
set "fn=%%H"
setlocal enabledelayedexpansion
set "fn=!fn:~3!"
echo !fn!>>abc-out.txt
endlocal
) Quote from: Squashman on September 28, 2016, 06:47:40 AM

Code: [Select]echo off
FOR /F "tokens=1* delims= " %%G IN ('find /I "received pdf" ^<abc.txt') DO (
   set "fn=%%H"
   setlocal enabledelayedexpansion
   set "fn=!fn:~3!"
   echo !fn!>>abc-out.txt
   endlocal
)


It's always easy to fiddle with code that's already written.   
This is a little bit of a hack, given the characteristics of the text.

Code: [Select]echo off
(
FOR /F "tokens=1,*" %%G IN ('find /I "received pdf" ^<abc.txt') DO (
FOR /F "delims=PDF" %%J IN ("%%H") DO echo %%%J)
)>abc-out.txt
Quote from: foxidrive on September 29, 2016, 02:52:24 AM

It's always easy to fiddle with code that's already written.   
This is a little bit of a hack, given the characteristics of the text.

Code: [Select]echo off
(
FOR /F "tokens=1,*" %%G IN ('find /I "received pdf" ^<abc.txt') DO (
FOR /F "delims=PDF" %%J IN ("%%H") DO echo %%%J)
)>abc-out.txt

Yes Foxidrive.  I had that idea as well but thought it might not be bullet proof.  So I just stuck with the substring. Quote from: Squashman on September 29, 2016, 08:38:09 AM
Yes Foxidrive.  I had that idea as well but thought it might not be bullet proof.  So I just stuck with the substring.

It's pretty likely that the example isn't representative of the actual filenames and so your code is the only one that will work in the real situation Squashman.

I amused myself by fiddling with your code in that way.  

I had noted at that point that it had been over 24 hours since his last POST and the OP hadn't been back to say 'thanks' to you.   Doesn't that grind your gears?I like when you guys double-team....things get done...then the OP gets abducted by aliens... Quote from: patio on September 29, 2016, 09:04:51 AM
...then the OP gets abducted by aliens...

That's the answer!  How stoopid of me, and I USED to watch the X-Files documentary too!



Triple Tag team matches are fun here... sorry Guys... I was just swamped by the issue... Just a quick word of thanks and I am trying to fiddle so there is a prompt of reply on my email

Thanks again... I will run the code and see ...Hi Guys, I am back from running the codes...

I tried saving both Squash and Fox version into a-test.bat and ran it (I hope this is correct way)... but have different results

Squash code did not output abc-out.txt
Fox code output abc-out.txt but 0kb inside

will it help if I paste the redacted sample here ? I think we are in different timezone probably a minimum 8hrs different. so delay will be experienced unless... that is what those greenies wants me to think.....

cheers guys Quote from: hdragon33 on October 03, 2016, 02:59:29 AM
Hi Guys, I am back from running the codes...

I tried saving both Squash and Fox version into a-test.bat and ran it (I hope this is correct way)... but have different results

Squash code did not output abc-out.txt
Fox code output abc-out.txt but 0kb inside

will it help if I paste the redacted sample here ? I think we are in different timezone probably a minimum 8hrs different. so delay will be experienced unless... that is what those greenies wants me to think.....

cheers guys
Well I TESTED my code with your exact examples before I posted my code.  So if you changed it at all trying to fit it into some existing code then you need to post all your code.As they say.  Proof is in the pudding.
Code: [Select]C:\Users\squashman\Desktop>type so.bat
echo off
FOR /F "tokens=1* delims= " %%G IN ('find /I "received pdf" ^<abc.txt') DO (
        set "fn=%%H"
        setlocal enabledelayedexpansion
        set "fn=!fn:~3!"
        echo !fn!>>abc-out.txt
        endlocal
)
C:\Users\squashman\Desktop>type abc.txt
connect

connection established; transferring PDF123456-qwe.sts
Received PDF123456-qwe.sts

connection established; transferring PDF223456-qwe.sts
Received PDF223456-qwe.sts

connection established; transferring PDF128456-qwe.sts
Received PDF128456-qwe.sts

Connection stopped
C:\Users\squashman\Desktop>so.bat

C:\Users\squashman\Desktop>type abc-out.txt
123456-qwe.sts
223456-qwe.sts
128456-qwe.sts

C:\Users\squashman\Desktop>Hi Squashman,

I just realised that you are using "received pdf" as the search key... I made some modification. it is working somewhat.

I am trying to learn coding, if it is not too much can you help explain the code line by line ?

Thanks a million Quote from: hdragon33 on October 03, 2016, 06:46:09 PM
I just realised that you are using "received pdf" as the search key... I made some modification. it is working somewhat.
This TELLS me you are not providing an accurate example of your input text file.  Not going to bother explaining the code if it is not working 100% because if you change the examples of your input and output, the code could change drastically and then I am wasting my time explaining even more code.Hi Squashman,

I play around with few fiddles, and manage to get it work... below are some comments of how it works, correct me if I am wrong

echo off
FOR /F "tokens=1* delims= " %%G IN ('find /I "received pdf" ^
[HDragon] this line looks for "received pdf" line and execute a search for the first instance (token=1) it sees the delimiter default of
question -> how to specify a delimiter of a full stop <.>

        set "fn=%%H"
        setlocal enabledelayedexpansion
        set "fn=!fn:~3!"
        echo !fn!>>abc-out.txt
        endlocal

[Hdragon] can you explain the 5 lines above ? I know the <~3 > does some sort of spacing count
I have been trying to look for a URL that give tutorials into all these command, do you have one to recommend ?
)
1076.

Solve : batch file moving files which contains 2 specific values to different folder?

Answer»

hi all,

I currently have a folder with 160.000 files. al the filenames are a combination of 2 different id's, an original filename and a location where it used to be located
(e.g. 12345$RESUME#56789_mydocuments.pdf)

the numbers their self are not unique, but the combination of the 2 is unique.

I would like to MAKE a SCRIPT for a batch file which move the files which contain the 2 numbers (e.g. 12345 and 56789) to be moved to a specific folder.

could someone help me to make a script for this.

Thanks a LOT Quote from: derksen1986 on August 17, 2016, 09:50:09 AM

I would like to make a script for a batch file which move the files which contain the 2 numbers (e.g. 12345 and 56789) to be moved to a specific folder.

MOVING files to a specific folder is easy.

But writing a batch script that is less likely to mangle your files really requires specific details.

1077.

Solve : Rename and Move PDF Files to Folder?

Answer»

Hi,
I'm very new to Batch Programming and can't still try to create my own for the script I needed.
Say I have 10 or more pdf files in a folder --- c:\Invoices which I would like to transfer those pdf files to c:\Invoices\Moved Files
But before moving, I would like to rename these pdf files into a series using the user input so it would be a script like:
Code: [Select]set /p NameSeries=What is your name series?
Say the series input by user is "JENNY-0000" , then the pdf file names would be JENNY-0001, JENNY-0002, JENNY-0003 and so on until all the files where renamed say there are 20 pdf files to rename, then it would be JENNY-0020 for the last item.
Then all these files will be moved as mentioned above.
Thanks!
Sorry I will not write it for you. But I have some questions.
Is this something that has to be done very often?
Would like to do this inside of the graphical interface instead commandment prompt?
Yes, this will be done very often and by a lot of users.
Not sure what you mean by graphical interface but if that includes installing apps, then it is forbidden in our company that is why I can only study batch file scripting.Somebody NEEDS to tell you or your boss that use of DOS commands in Windows 8 is not the path Microsoft recommends for administrative tasks.

Microsoft recommends any and administrators learn PowerShell, whether they program or not. Microsoft has forums another means to help administrators manage takes in a Windows based work group.

Now CH is indeed the right place  to get help with  batch file scripts. Somebody will come here shortly.

Bear in mind CH cannot take any RESPONSIBILITY for problems you encounter.

What I mean to stress is that batch programming over r the years has not improved in areas  of critical management of more complex working scenarios  found in today's windows work group environments.

Here is a reference of interest:
Break Your Batch Habit and Move to PowerShell
Quote

Starting in Windows 2000 (1999), Microsoft added to its scripting power by introducing the Windows Script Host (WSH) and two real, built-in, programming languages (VBScript and JScript--Microsoft’s version of JavaScript). WSH scripts rely on COM objects to interface with the operating system and applications. While WSH is extremely useful and powerful, it’s limited to COM objects that are installed on the computer and doesn’t provide a command-line interface.
The article goes on to explain how PowerShell is now the preference for command line scripts. Batch files can support PowerShell scripting.

Please understand my concern.  Hi Geek, it is new for me to hear Powershell. I'm reading it now and its good to know that there are no addtl apps needed to install but just saving it to Name.ps1 instead of .bat. Does this mean that my query above can be done using powershell? ThanksI still can't figure out how to write it in batch or in powershell but anyone who can help me with this please. Here's the scenario of the code:
Code: [Select]set $nameseries = What is your name series?
ForEach *.pdf {
$nameseries = $nameseries +1
rename $nameseries
move C:\Invoices c:\Invoices\Moved_Files
Thanks a lot in advance!
Quote from: austinandreikurt on August 20, 2016, 11:39:42 PM
Say the series input by user is "JENNY-0000" , then the pdf file names would be JENNY-0001, JENNY-0002, JENNY-0003 and so on until all the files where renamed say there are 20 pdf files to rename, then it would be JENNY-0020 for the last item.

Your task isn't very clear at this point.
You've said that the user types "JENNY-0000" but haven't said why they are typing the "0000" part.

Batch file commands do precise things, and if the task isn't WELL laid out then the code you get may not work.Hi, the name series depends on the user but it will always state a 5 letter word, then a hypen "-" then four 0's that will represent the max of 9999 files to rename and move.but it is also ok to just ENUMERATE the 5letter word by the user's input and the script automatically put a 4 number series starting from 0001 to 9999.

Also, the reason why it needs to be 0001 instead of just 1 is to be able to sort the items when moved because JENNY-1 will have JENNY-10 as the next one instead of JENNY-2. To avoid it, we need to have it like JENNY-0001, JENNY-0002, JENNY-0003 and so on. Quote from: austinandreikurt on August 21, 2016, 05:54:45 AM
Hi, the name series depends on the user but it will always state a 5 letter word, then a hypen "-" then four 0's that will represent the max of 9999 files to rename and move.but it is also ok to just enumerate the 5letter word by the user's input and the script automatically put a 4 number series starting from 0001 to 9999.
What do you expect to happen when Jenny already has backup files Jenny-0001.pdf to Jenny-0020.pdf and then Jenny has some more files to save?Jenny files should be 867-5309...Hi foxidrive.the batch will just overwrite them as it is regularly cleaned-up by the user so there should be no duplicates.Test this script and let me know how it goes.

Code: [Select]echo off
setlocal enabledelayedexpansion
   set /p "name=Enter your 5 character name: "
   set c=10000
   set "folder=Moved_Files"
   md "%folder%" 2>nul
      for %%a in (*.pdf) do if exist "%folder%\" (
          set /a c+=1
          move "%%a" "%folder%\!name!-!c:~-4!%%~xa"
     )
pause


I think Jenny works at a different phone number down here.
Quote from: patio on August 21, 2016, 09:18:28 AM
Jenny files should be 867-5309...
Wow. exactly what I need. thanks a lot foxidrive!
1078.

Solve : Stderr output?

Answer»

Hi all,
im writing a simple BATCH file which echo a statement to an output file and for some REASON if path for the output file is not available, I want the error to be sent to another file.
My batch file script looks like this.

echo test > "path for output file " 2> "C:\test\output.err"

When I run above batch file it fails with error "The system cannot find the path specified." which is fine, however I want to capture this error and send it to C:\test\output.err which is not happening .
Can someone shed light on this?First, did you read this?
https://support.microsoft.com/en-us/kb/110930
Redirecting Error Messages from Command PROMPT: STDERR/STDOU

Quote

When redirecting output from an application using the ">" symbol, error messages still print to the screen. This is because error messages are often sent to the Standard Error stream instead of the Standard Out stream.

Read the article for more details.multiple redirection operators specified this way only work on a single command; that is, in this case, the command is redirecting the standard output and standard error of the "echo test"; the redirection to standard error is not redirecting the standard error of the output from the redirection of the standard output. (Now there is a tongue twister...)

You need to separate it like so:

Code: [Select](echo test > "path for output file ") 2> "C:\test\output.err"

This way you are saying to redirect the output of "echo test" to a file, and then redirecting the standard error of that redirection itself to another file.BC_Programmer is right.Started helping the user on destiny about an hour before they posted here.
http://www.dostips.com/forum/viewtopic.php?f=3&t=7439 Quote from: Squashman on September 28, 2016, 10:51:24 PM
Started helping the user on destiny about an hour before they posted here.
http://www.dostips.com/forum/viewtopic.php?f=3&t=7439

Doesn't it get annoying!
1079.

Solve : Help with dos commands, lost admin password?

Answer»

I recently helped someone reset there lost admin PASSWORD on a local account Windows 10. I found this website and followed it successfully.
 http://www.pcworld.com/article/2988539/windows/if-you-forget-your-windows-admin-password-try-this.html.
I don’t know if I’m in the right place to get answers for my questions but I would appreciate it if someone would take a look at this. To make this short I’ll cut to the meat of the issue.  After booting from a usb and opening cmd the first command lines are
X:
Cd windows\system32
Ren utilman.exe utilhold.exe
Copy cmd.exe utilman.exe
Exit
My first question is, why did we rename utilman.exe utilhold.exe? Second question is, if utilman.exe has a different name then why did we copy cmd.exe to the old file name utilman.exe? I would assume utilman.exe only exist with a different name, maybe that’s not so.
This is the commands to put things back to normal. I haven’t applied this so I can’t say this works yet. 
X:
Cd \windows\system32
Copy utihold.exe utilman.exe
Exit
OK here we go. I ran this command windows\system32 dir /p, and both files utilman.exe, and utilhold.exe do exist.  So what did we do with the last copy command line? Did we copy the contents of utilhold.exe into utilman.exe, simultaneously deleting utihold.exe and the old contents of utilman.exe w/cmd.exe? I’m not very experienced with using Dos command lines so some of this is a little confusing. If someone could maybe spell this out to me it would be very much appreciated.
Thanks
Mike
It is a trick. The program is used for another purpose in Windows.
Quote

Utilman.exe is a built in Windows application that is designed to allow the user to configure Accessibility options such as the Magnifier, High Contrast Theme, Narrator and On Screen Keyboard before they log onto the system.

The link you gave is not the way MS recommends password recovery.  The trick undermines the whole concept of having a password.
Next time tell your people  to use a code or name that is EASY to remember.
Here is one:
qwerty123
That is very easy to remember. And you will not have to resort to some kind of trick.

For more info, just Google utilman.exe
In Windows you can use accessibility options from the login screen and they use utilman.exe. By effectively having cmd.exe be utilman.exe you get a command prompt instead.

It is undone by copying the renamed file back to utilman.exe.Two questions.
1. Geek-9pm
What does MS recommend for password recovery?
2. BC_Programmer
What I'm having trouble with is the mechanics of all the command lines. From what you are telling me the last command "copy utilhold.exe utilman.exe". Does that copy and rename the file back to utilman.exe? It looks to me like it just copy's utilhold to utilman but doesn't rename any thing.
Mike Quote
What I'm having trouble with is the mechanics of all the command lines. From what you are telling me the last command "copy utilhold.exe utilman.exe". Does that copy and rename the file back to utilman.exe? It looks to me like it just copy's utilhold to utilman but doesn't rename any thing.

the commands are pretty much exactly as they appear.

Code: [Select]X:
Change current drive to drive X.
Code: [Select]Cd windows\system32
change the current directory to \Windows\system32 on the current drive (X).
Code: [Select]Ren utilman.exe utilhold.exe
rename utilman.exe in the current directory to utilhold.exe.
Code: [Select]Copy cmd.exe utilman.exe
Make a copy of cmd.exe and call it utilman.exe


And then undoing the action:

Code: [Select]X:Change current drive to X.
Code: [Select]Cd \windows\system32Change the current directory on the current drive to \Windows\System32.
Code: [Select]Copy utihold.exe utilman.exe
Copy the file utilhold.exe and call the copy utilman.exe.Your question was:
"What does MS recommend for password recovery?"
Microsoft does not have an explicit tool that will reset anybody's password anywhere at any time. Instead, Microsoft has built into the system a number of safeguards and utilities that should make it unnecessary for a person to reset the password using software alone.

One of the tools is the ability of a Windows computer to have more than one user and each user to have his own password. Thus if you cannot login with one user password combination, you can use another.

The second tool that is available is the use of hidden users. You have a hidden user with a name you would remember and a very easy or even nonexistent password. Hidden users are documented elsewhere.

Third, a feature in Windows 10 is that the password can have an alias of a four DIGIT number. This allows a user to enter in to the system using a four digit number. However, this four digit number only works from the console and not from anywhere else. And the digits can be changed later and the password is the same.

Another provision that Microsoft has made is service for a fee. If you have a very DIFFICULT problem, including password recovery, you can call into Microsoft and get telephone support for a fee.

Yet another feature available is the use of the same password and user as for your Microsoft account. If you forget your password for some reason, you can go to another computer and access Microsoft and request that your password be reset. There are number of steps you take their to reset your password online. Once that is done, you can then go to the computer of the lost password and you should be able to sign in if there is an Internet connection.

So there  you have about 5 ways to recovery the password without using a hard core software hack.

In short, there are a number of remedies that Microsoft has already provided without the need for an explicit piece of software that would just out right reset the password with minimal effort. Such a tool would only reduce the security of everybody else.

As a reference, let me refer you to the issue that Apple had with the FBI. The FBI wanted Apple to find a way to easily break into an Apple iPhone that was in the position of a deceased terrorist. Apple refused on the GROUNDS that it would compromise the security of all the other Apple iPhone users in the whole world.

From this, one could see that a company such as Microsoft, Apple or IBM or any of the big companies should never, ever publish a tool that would make it easy to change other people's passwords.

And this is not just my idea. A large number of people have the same thought. You just cannot make it easy for people to crack passwords.

Hopefully, this will clarify the position of myself and a number of others. Soapbox removed... Quote from: Geek-9pm on August 22, 2016, 12:10:22 PM
without the need for an explicit piece of software that would just out right reset the password with minimal effort. Such a tool would only reduce the security of everybody else.

There's a tool that can reset any password and all it needs is physical assess to the machine to boot up a CD or USB stick. 

I've had the need to help people with machines that with forgotten passwords and it's a simple matter to nuke the password and reboot the PC and you're in.  I'd say what it is but I might get my wrists slapped.   kinky, eh?

Quote from: patio on August 22, 2016, 12:52:08 PM
Soapbox removed...
Bugger.  I was looking forward to somebody else doing that for a change.  Quote from: MIke50 on August 22, 2016, 10:37:57 AM
What I'm having trouble with is the mechanics of all the command lines. From what you are telling me the last command "copy utilhold.exe utilman.exe". Does that copy and rename the file back to utilman.exe? It looks to me like it just copy's utilhold to utilman but doesn't rename any thing.

That's not a clean bit of code because it leaves the utilhold.exe laying around.  Either of these should be cleaner:
Code: [Select]X:
Cd \windows\system32
move utilhold.exe utilman.exe Code: [Select]X:
Cd \windows\system32
Copy utilhold.exe utilman.exe
del utilhold.exe
rem ...the problem with using the del command is that if the line above was typo'd then the utilman.exe file could be gone.

And this is more versatile code that handles any drive letter, rather than the first two lines of code in your examples.
Code: [Select]pushd "%windir%\system32"
Sorry for not getting back sooner. I have been very busy lately. Thanks for spelling that out for me. I was having a hard time getting my head into what that copy command was doing. Probably had some  preconceived ideas because I use copy and past in the regular Windows UI.
Thanks Again
MikeThis has gone beyond Forum guidelines...Topic Closed.
1080.

Solve : Archive (PST) Mapping in outlook?

Answer»

Is there any tools, batch or script that would allow me to point the location where all a users PST files are kept and will map those
pst files at one time rather than mapping each and every pst file one at a time.

(Example) If the users has multiple PST files mapped in Outlook where they store emails based on certain criteria, many of the users have 10, 20 and 
                 even 50 individual PST files mapped in Outlook. All of the users PST files are store in COMPUTER local drive.

Does anyone know is there such a freeware utility, or is there any batch and script file to be ABLE to execute the task?

Seen this DONE with group policy... more at the link

https://www.msoutlook.info/question/370DaveLembke, as I does not wish to modify group policy in registry. I would like to map all user email archives from outlook at one time, rather then having to map every email archives one at a time.

Any ideas how can this be done.

  Group Policy would allow for you to make 1 change to group policy that affects all users as part of that group. No registry hacking at each computer required. When they login to the network and inherit group policy they will be mapped to the same location. You would not have to do this one at a time, users just would need to reboot COMPUTERS and when logging back on the new policy takes affect and problem solved. The link I shared shows many ways of pulling this off not just with GP.


Quote

Setting the default via Group Policy

In a corporate network environment, setting the default location for pst- and ost-files is usually something you want to set via Group Policy. You can find the setting under:

Microsoft Outlook <version> –> Miscellaneous-> PST Settings

    Default location for OST files
    Default location for PST files

When your users use multiple computers for which the location of the ost- or pst-file should be different as well (for instance, the location for these files should depend on whether they use a Desktop or a Laptop computer), then you can either place these devices in separate OUs and assign the different policies at OU level or place them in separate groups but in the same OU and use Group Policy filtering instead.
Is there anyway to create a batch file or script or a program which can map all the users outlook email archive (.PST) at one time, instead of editing regedit and change the settings of outlookA batch would have to inject registry settings to alter each computer. And its way more involved and dangerous than group policy configuration.how about any softwares?Im not AWARE of any software that does this as for most people use the free or readily available methods. Only software I know of for PST files is a PST reader called PST Walker that allows reading of PST files without Outlook installed but thats NOT what you need.
1081.

Solve : how to create a bootable disk (CF card) under Windows 7??

Answer»

I would like to format my CF card into a bootable media so that my system image file, VxWorks, can be started up by BIOS after power on. Long time ago, I did it by DOS command: "format f: /s". It's very simple. But now, it doesn't work at Windows 7. I even used Computer Management tool to format it, but I can't find the option of 'system'. The formatted CF card is not bootable even I copied my system image into it. Let me know how I can do it.You need to use a tool that creates a bootable USB drive.

RMPARTUSB is one such tool.  I haven't tried a CF card using that but you can have a shot.If your expecting to run an OS off of that card good luck...I use the " HP USB Disk Storage Format Tool" for Win7, I use V2.1.8 but a v2.2 is available for download.

This tool formats USB storage devices, I put the CF card in a SanDisk USB reader and run on a Win7 machine. The option is OFFERED to make the card Bootable, move the files required into a subdirectory on the Win7 machine. I format the CF card as FAT-32, and use Win98se booted into realmode via bootgui=0 in MSDOS.SYS. The cards boot on a VortexDX embedded processor, then runs PharLap in protected mode. Reference:
https://en.wikipedia.org/wiki/CompactFlash
Quote

In November 2010, SanDisk, Sony, and Nikon presented a next generation card format to the CompactFlash Association. The new format has a similar form factor to CF/CFast but is based on the PCI Express interface instead of Parallel ATA or Serial ATA.[10][11] With potential read and write speeds of 1 Gbit/s (125 MByte/s) and storage capabilities beyond 2 TiB the new format is AIMED at high-definition camcorders and high-resolution digital cameras, but the new cards are not backward compatible with either CompactFlash or CFast. The XQD card format was officially announced by the CompactFlash Association in December 2011.[12]
Quote
It has enough speed.
I'm assuming the OP meant traditional CF cards, which is what I use. I use mostly 256MByte, 1GByte, and 2GByte cards. I prefer FAT-32 for efficiency. I use these in PC104 format embedded systems and ICOP VortexDX boards. The ICOP boots off of USB, had a custom CF reader integrated into the custom computer. The PC104 WinSystems board comes with the CF reader built in. I also use Panasonic Toughbooks models CF-51 and CF-52, both can be configured to boot off the USB port- including the CF cards in a reader. My CF-52 now has a 512GByte Fat-32 SATA (not easy to do) drive that dual-boots DOS 7.1 (win98se realmode) and XP. Himem.sys gives DOS access to up to 3.4GBytes RAM, either booted off the hard-drive or the CF card.

WinSystems sells an industrial grade CF card pre-configured to boot for their systems. Using the HP utility provides a large cost-savings compared with the Winsystems cards. The latter are spec'd for high-temperature operation, but I did not require the full temperature range.
1082.

Solve : Installing FreeDOS on a Thin Client?

Answer»

Hi,

I am trying to figure out how to use (or more preferrably, install) FreeDOS onto a Wyse WT1125SE thin client. I want to make it into a tiny compact DOS computer for playing some games on.

I cracked mine open and noticed it had a 44-pin IDE port on the board, but with nothing attached to it. Should I spend more money and buy an SD to 44-pin IDE adapter, install FreeDOS on that, and try to boot from it? I don't know how to boot from USB or go into the BIOS to try installing FreeDOS that way. I'm not even sure this is possible at all. I'm really hoping it is being that I SPENT a lot of money to get mine and I don't want to go through the hassle of shipping it back.

Thank youHow much did you spend ? ?
I went to the spec site and couldn't find out if it'll even boot to USB which you would need to do what you wish...
I would contact the manuf. before you go spending any money from here out...I personally would never use a thin client for such a DOS gaming rig. UNLESS you found others online who have done this as a guide, your completely on your own with this hardware as for people avoid thin clients for an application like this. It might work or it might not. But if you get it to work, your likely going to have issues with no sound etc. Its more work to try to bend this hardware to work with DOS than it is to avoid a thin client for a system that will easily run DOS or FreeDOS. Thin clients by design are meant to connect to servers OFFERING a thin client service in which there is a boot string on the thin client or PXE boot over ethernet. The thin client you have that is lacking a drive is likely a decommissioned PXE boot type.

If you want a small DOS rig, I would go with a Intel Atom Netbook or ITX board desktop computer if going with somewhat modern hardware. With a somewhat modern system you could run the DOS games through DOSBOX. Or find an old computer that is rated as a match to the games you plan to play in which drivers for sound will be each to COME by etc.patio: I spent ~$50 on this, and I can phone the manufacturers tomorrow to ask them what they think.

DaveLembke: I've gotten an HP T5000 thin client from someone on eBay in the past, which had MS-DOS 6.22 on it. I wiped it and put FreeDOS on that one, and now it's got FAT32 USB support, making it incredibly easy to download DOS games, copy them to the flash drive and play them straight off of there. The only fault with it is that it's only got PC Speaker sound.

I feel that this might be possible, being that it's got an IDE port right on the board, but again, I'm not certain. Quote

I've gotten an HP T5000 thin client from someone on eBay in the past, which had MS-DOS 6.22 on it. I wiped it and put FreeDOS on that one, and now it's got FAT32 USB support, making it incredibly easy to download DOS games, copy them to the flash drive and play them straight off of there. The only fault with it is that it's only got PC Speaker sound.

So your making a second box like this then... but different manufacturer build... I personally would have stuck with the prior known working HP model for what your doing as for there is no guarantee that there are the needed USB DOS drivers for the Wyse. Additionally you can get an Intel Atom mini computer like the thin client but not a thin client and have better support for the kind of thing your doing.

If it were me wanting to make a miniature DOS system, I'd go with something like this and then DOS BOX the DOS environment within Windows or Linux with WINE http://www.newegg.com/Product/Product.aspx?Item=N82E16856205007&ignorebbr=1

A mini computer like this has so much more potential to play far more games and both DOS games and somewhat modern games that are not too heavy on graphics. You could lay games about as graphically intense as Diablo II on this mini computer linked above. I have run Diablo II on my Intel Atom Netbook with n280 1.66Ghz and while you can see the APU chugging on it and working to maintain the game, its not that bad of an occasional barely noticeable slow down, and this Atom in this mini computer is more powerful than the n280. I have a desktop with the D510 Atom and its able to play World of Warcraft on lowest video quality for example with 2 cores with hyper threading that act like 4. *I dont play wow on it, but did so to push the hardware and test its limits. I was getting 12-20 fps on the Atom D510 with World of Warcraft on lowest quality and 1024x768. World of Warcraft on netbook with Atom n280 is like 2-4 fps and pretty much unplayable with lowest settings as a comparison.

With the Wyse since you already own it, give it a try and see if it works. Hopefully it wasnt money wasted.

1083.

Solve : Pass Variable and a Variation to a batch file?

Answer»

I'm just ... brain dead. Here is what I would like to do.

I'm passing a video file to the batch file for conversion, but the is another file, with a .info extension that I need to rename, it's a text file with info of the video file in it which is matched to the extension.

Example, I pass superman.ts to the batch file and it's converted to superman.mp4 - I got that.

Now I need to take the existing superman.ts.info and COPY it to superman.mp4.info - (so there are two files) that's where I'm stumped as all I can pass to the batch file is the actual video file.

What I've come up with is a batch file that converts the video and then COPIES the video to superman.mp4.info.I see what your seeing I think your issue is you get the extra .ts for all .ts.info files to become .mp4.info:
Code: [Select]ren *.ts.info *.mp4.info
Quote

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\test123>dir
 Volume in drive C has no label.
 Volume Serial Number is 125F-376A

 Directory of C:\test123

10/06/2016  09:02 PM    <DIR>          .
10/06/2016  09:02 PM    <DIR>          ..
10/06/2016  09:02 PM                 3 aaaaa.ts.info
               1 File(s)              3 bytes
               2 Dir(s)  13,667,860,480 bytes free

C:\test123>ren *.ts.info *.mp4.info

C:\test123>dir
 Volume in drive C has no label.
 Volume Serial Number is 125F-376A

 Directory of C:\test123

10/06/2016  09:03 PM    <DIR>          .
10/06/2016  09:03 PM    <DIR>          ..
10/06/2016  09:02 PM                 3 aaaaa.ts.mp4.info
10/06/2016  09:03 PM    <DIR>          test
               1 File(s)              3 bytes
               3 Dir(s)  13,627,613,184 bytes free

C:\test123>

What does your batch look like and is this the problem your running into?

My guess is this is the issue with the extra .ts which is part of the file name so wildcard is passing filename.ts Quote from: RBraverman on October 06, 2016, 05:46:56 PM
a .info extension that I need to rename

Now I need to take the existing superman.ts.info and copy it to superman.mp4.info - (so there are two files)

I edited my reply after I re-read your question.
Hmm, then I re-read it another time and my head imploded.  You asked for two different things, didn't you?

You said to rename the file and then wanted to have two copies of the .info file.
Based upon your details this should copy the info file to an mp4 extension.

Code: [Select]copy  "%~dpnx1.info" "%~dpn1.mp4.info"
and this will rename it.

Code: [Select]ren "%~dpnx1.info" "%~n1.mp4.info" Quote from: foxidrive on October 06, 2016, 10:56:35 PM
I edited my reply after I re-read your question.
Hmm, then I re-read it another time and my head imploded.  You asked for two different things, didn't you?

You said to rename the file and then wanted to have two copies of the .info file.
Based upon your details this should copy the info file to an mp4 extension.

Code: [Select]copy  "%~dpnx1.info" "%~dpn1.mp4.info"
and this will rename it.

Code: [Select]ren "%~dpnx1.info" "%~n1.mp4.info"

MANY THANKS for replying, I just knew I'd make this more complicated ....

You are right, convert a file with the passed video.ts (to video.mp4) and copy a file associated with it with the name of video.ts.info (separate text file) to video.mp4.info.

I have tried what you suggested before and now again and this is what I get (which is driving me crazy, I might add), which is why I put it away for a week or two:



[attachment deleted by admin to conserve space]Alot easier and quicker  to copy and paste from the cmd window to the forum then making a screenshot.

You can see from your file listing that the file you are trying to copy does not exist.  So I am confused as to what you are trying to do.I see what you are doing now.  You are trying to run the batch file with just the ts.info file.  The code you were given assumed you were processing the base .ts file and the copy code would find the ts.info file and rename it based on the .ts file name. Quote from: Squashman on October 07, 2016, 08:21:33 AM
A lot easier and quicker  to copy and paste from the cmd window to the forum then making a screenshot.

I tried but couldn't. Sorry.

Quote from: Squashman on October 07, 2016, 08:21:33 AM
You can see from your file listing that the file you are trying to copy does not exist.  So I am confused as to what you are trying to do.

Ok, I knew I wasn't going to be clear - the inuithighkick.ts.info does exist - that is the file that is to be copied to inuithighkick.mp4.info Quote from: Squashman on October 07, 2016, 08:31:47 AM
I see what you are doing now.  You are trying to run the batch file with just the ts.info file.  The code you were given assumed you were processing the base .ts file and the copy code would find the ts.info file and rename it based on the .ts file name.

I didn't use the processing of the video.ts file as that will take 20 minutes - just to see if the info file copies.

Ok, lemme try the full batch.

Again sorry - I should have seen that.

DANDY.

I didn't use %~dpnx1, I was trying to use %~n1 - and, needless-to-say - I got a copy of the video with a info extension.

Can you explain what's happening here? My understanding of %~dpnx1 wouldn't WORK here.You can read about all the variable modifiers by opening up a cmd prompt and typing for /?

Here is the snippet you want to look at.
Code: [Select]In addition, substitution of FOR variable references has been enhanced.
You can now use the following optional syntax:

    %~I         - expands %I removing any surrounding quotes (")
    %~fI        - expands %I to a fully qualified path name
    %~dI        - expands %I to a drive letter only
    %~pI        - expands %I to a path only
    %~nI        - expands %I to a file name only
    %~xI        - expands %I to a file extension only
    %~sI        - expanded path contains short names only
    %~aI        - expands %I to file attributes of file
    %~tI        - expands %I to date/time of file
    %~zI        - expands %I to size of file
    %~$PATH:I   - SEARCHES the directories listed in the PATH
                   environment variable and expands %I to the
                   fully qualified name of the first one found.
                   If the environment variable name is not
                   defined or the file is not found by the
                   search, then this modifier expands to the
                   empty string

The modifiers can be combined to get compound results:

    %~dpI       - expands %I to a drive letter and path only
    %~nxI       - expands %I to a file name and extension only
    %~fsI       - expands %I to a full path name with short names only
    %~dp$PATH:I - searches the directories listed in the PATH
                   environment variable for %I and expands to the
                   drive letter and path of the first one found.
    %~ftzaI     - expands %I to a DIR like output line Quote from: RBraverman on October 07, 2016, 10:03:24 AM
I didn't use the processing of the video.ts file as that will take 20 minutes - just to see if the info file copies.

A way to test it could have been to use a video file that was 2 seconds long.

Ask direct questions if you still have trouble understanding the info Squashman has shown you.
1084.

Solve : Bat file FOR statement referencing file-set with embedded blanks.?

Answer»

How do I use the MS-DOS FOR COMMAND to parse a file whose name contains a blank?

Ordinarily, I'd surround the name with quotation marks, but this is interpreted as a string to be parsed, rather than a filename.

Thanks in advance.This is one way:

Code: [Select]echo off
for /f "usebackq delims=" %%a in ("c:\folder\filename and space.txt") do echo %%a
Quote from: John_L. on October 10, 2016, 10:51:51 AM

How do I use the MS-DOS FOR command to parse a file whose name contains a blank?
Hi John,
In this thread and your previous thread you mentioned you are using DOS. Be advised that cmd.exe is not DOS if you are using a variant of Windows NT (2000,XP,Vista,7,8,10).  If you really NEED help with a specific command in regards to DOS then you need to specify what version of DOS you are using. Quote from: Squashman on October 11, 2016, 07:29:50 AM
you are using a variant of Windows NT (2000,XP,Vista,7,8,10)

You nailed it there Squashman.  No version of MSDOS can parse the contents of a file using the FOR command.

The only way a filename can have a space in MSDOS is by using a disk editor and shoving one in that way.   

I believe I'll have another glass of medicine.   Jack Daniels is medicine, right??  No?  What about Johnny Walker??    The DOS FOR command has a lot of FEATURES that are not bedded in a simple loop.
One can create a simple loop that calls another BAT file taught will compare contents of a file. A list of file scan be made with
Code: [Select]DIR /B >LIST.TXTNo FOR loop  needed.

Some of the work will be done manual. But once you have a valid method, you can find some way to make it take parameters are work automatically.

Cant OP give a basic outline of the task? What is the purpose? How much data? What kind input? What would be the output?


Quote from: Geek-9pm on October 11, 2016, 03:32:51 PM
not bedded in a simple loop.

BAT file taught will compare contents of a file.

A list of file scan

It seems that your speech-to-text converter needs a grease and oil change, geek. 




It seems pretty clear that the op was abducted by aliens.  This is becoming a serious problem.
 The problem has been duly noted. Today I received a brand-new microphone and hopefully the dictation will be more accurate in the future.
Also, filenames with blanks can be a problem and makes me wonder why not just not use planks on all and reduce the trouble. A common practice is to use the_in place of a blank . In most cases that should not be a problem.
Well, so far the new microphone is working good. Quote from: Geek-9pm on October 15, 2016, 05:10:21 PM
The problem has been duly noted. Today I received a brand-new microphone and hopefully the dictation will be more accurate in the future.
ahhh, a new tech toy.   I have a liking for new tech toys.

The gain setting will likely have an effect on speech recognition, but of course within the good range and not just high for the sake of high gain.    I've seen that background noise is a particular issue that can make wurds rong, so make sure the cat isn't too noisy when she's playing with the PLASTIC bags. 
1085.

Solve : delete xml Files in folder when corresponding TS files doesn't exist?

Answer»

Hi,
I have a home theater pc and wanna clean the folder "m:\recorded tv" every day.
I'm searching for a batch file that deletes all xml files in this folder where no corresponding TS files exists.
For example this folder looks like this:
Video1.ts
Video2.ts
Video1.xml
Video2.xml
Video3.xml
Video4.xml

After the batch file was running the folder should look like this:
Video1.ts
Video2.ts
Video1.xml
Video2.xml

Video3.xml and Video4.xml are no deleted.

In the www I have found this

FOR %%I IN (*.*) DO IF NOT EXIST "%%~dI%%~pI%%~nI.ts" (del %%~nI.*)
exit

But that's not working properly.

Can someone help?

olli14ollii14,
I have a batch file below from foxidrive that I use to delete *.CR2 files that do not have a corresponding *.JPG file with the same name. You could probably modify it to suit your needs.

Code: [SELECT]::Posted by foxidrive on another forum
::Modified to fit my needs.
::Delete any CR2 file that does not have a JPG file of the same name.
::The command line is set to ECHO the Delete command to a batch file for inspection.
::Run the created batch file to delete the .CR2 files.

::Put this batch file in with the folder that contains the .JPG and CR2 files.

echo off
if not exist *.jpg goto :fail
if not exist *.cr2 goto :fail

for %%a in (*.cr2) do if not exist "%%~na.jpg" echo del "%%a" >>!CR2_files_2B_del.bat
goto :EOF

:fail
echo Either the .CR2 or .JPG files are missing.
echo Make the necessary corrections. This batch file has failed.
echo Press the space bar to close this window.
pause>nul
goto :EOFHi Ocalabob,
it's working great. Thanks a lot.

olli14It's me again. As I wrote already the Batch is working. But now I want to clean all subfolders too. Someone an idea? Quote from: olli14 on OCTOBER 20, 2016, 01:31:55 AM

It's me again. As I wrote already the Batch is working. But now I want to clean all subfolders too. Someone an idea?
Look at USING the /R OPTION with the FOR command.  You will need to change the FOR variable modifiers as well. Quote from: olli14 on October 20, 2016, 01:31:55 AM
But now I want to clean all subfolders too. Someone an idea?

Do you want to remove every file in a Subdirectory tree?

This is easy as Squashman SAYS but it's a dangerous script to have laying around - as it could find itself in another place and then all files can be removed where it's not supposed to run.

The solution is to include the correct path so it can only operate in the correct folder.

Code: [Select]del /s /q /f "c:\your folder tree\and at the\right\folder\*.*"

Ocalabob who gave you your script was a good friend to me, and he passed away from Cancer on 2 November 2013
Here's a pic from happier times.


I'm not so sure that the fish was too happy, but Bob had a ball. 
His home base was in Florida.R.I/P/

So 2 months after the post above...

Thanx for the pic.
1086.

Solve : how to do division and rounding within the string??

Answer»

Hi all,
I'm new in scripting and I'm working with a tool which is exactly like windows cmd. My INPUT TEXT file is :

    age=min;age_1D_param_min_64;meas_time =

My batch file READS the lines from this input and splits the lines by “ ; ” then executes a function with the token and age file from the second field and after all parses the output for the third line.
in the following you can see my current batch file:
 
    setlocal EnableDelayedExpansion
    for /f "tokens=1,2,3* delims=;" %%a in (input.txt) do (
   REM create token file
   echo.%%a>current.tok

    sinoparam -p D:\product\%%B 0x0100001F current.tok> out.txt

    for /f %%y in ('findstr /C:"%%c" out.txt ^| sed "s/.*%%c .............. )do SET RESULT=%%y

    echo.%%a;%%b;%%c;!RESULT!>>finaloutput.csv
    )
    GOTO :EOF
now I have problem with one string in out.txt which is the result of executing my function:

    meas_time =31.9999
in my batch file I want to do the followings:

 1.find the value in string dActual_age =31.9999 by findstr/C

 2. if the value is lower than 1000 round it and show the result

 3. if it’s greater than 1000 first divide it by 32 and then round the result

Does anyone know how I can do this ?
thanks for any help!
HOdaHomework?scripting questions are not answered here?
We just don't think we're doing you any favors by doing your homework for you. On that note, I'm going to LOCK this thread.

1087.

Solve : Use a batch file as a midwife to a playlist.?

Answer»

Introduction.
A small little micro SD card could hold hundreds of MP3 files of songs at last perhaps two or 3 min. each. Using a single card for just one album seems to be a waste of space. And the amount of time it takes to erase a dozen songs and then copy over a dozen songs can be more than just a minute or so. These cheap SD  cards are rather slow when doing write operations. It should be faster to just change the filename itself rather than a erase all and copy a new files.

Now comes the headache.

Use a batch file as a midwife to a playlist.
That's the best I like to think of.

I have a small MP3 player that does not pay attention to playlists. It just simply plays any and all MP3 files it can find on the micro-SD card. Now if I had something like an iPod, this would not be a problem because I'm iPod would recognize a playlist. But this cheap little device does not recognize a playlist. But the reason I like to use it is because it's small and portable and cheap but with very good sound from the tiny speaker. In fact, it has better sound than I get from my smart phones and my tablets. So I prefer it for pleasant background music while I am laying in bed or otherwise relaxing.

Now the obvious thing to do would be to have a separate SD  card for each music collection I would like to listen to on this little gadget. But that seems to be a waste of something. The little tiny SD  card has so much capacity that it seems to be a waste to have separate cards for my separate playlists. There should be some way to just change the playlist on the little card. Alas, this little player doesn't have any idea about what playlists can do.

So I got the idea of making a batch file that would serve as a midwife. The batch file could change the extension names of the files that I didn't want to hear & keep the MP3 extension for the files I want to hear tonight.
Does that make any sense at all? Let me do an example.(Small for clarity.)
Let's say I named nine files like this:
song1.mp3,  song2.mp3, ,song3.mpx
song4.mp3,  song5.mp3, song6.mpx
song7.mp3, song8.mpx, song9.mpx
From the above, the player would only play songs:
1, 2, 4, 5, 7

So I need a way to have a BAT file rename the files to match the playlist I want. Of course, the player does not do batch. But I would put the card into my PC, run a quick batch and then put the car back in the player.

Once I get it to work, I  will load  the card with 100s  of songs and make ma five playlists for the genre I want for morning, noon, afternoon, night and whenever.

I will give myself two weeks to do this.
Will I be able to do this?
Thanks for your help.I just use Better File Rename for renaming like this. But that costs money. Question I have is, do you want to have control over what plays in which order? If so then i would think this would be a manual file rename process. A batch might work well then to prompt you with say the file that is to be renamed asking you what number to prepend to the name so say you have...

Paint it BLACK.mp3
Gimme Shelter.mp3
Jumping Jack Flash.mp3

But you want it to play in the order of

Jumping Jack Flash
Paint it Black
Gimme Shelter

The way I see it the batch would run alphanumerically through the directory listing so the first file up to prepend a number to would be Gimme Shelter with G being before J and P. You then would at the prompt of what value to prepend give it 3 the batch then renames Gimme Shelter.mp3 as 3_Gimme Shelter.mp3 and places that into a different completed work folder. Next the batch would grab for rename would be Jumping Jack Flash, and SINCE you want that first you would give it the value of 1 to prepend to the name, so it renames Jumping Jack Flash to 1_Jumping Jack Flash.mp3 and then finally it gets to the last file alphanumerically in this same directory Paint it Black, and since you want it to play second you give it a value of 2, in which the batch renames it to 2_Paint it Black.mp3

so in the end you have

1_Jumping Jack Flash.mp3
2_Paint it Black.mp3
3_Gimme Shelter.mp3

I already do a process like this manually for the 256MB old obsolete USB stick that keeps working and make up custom play lists this way via prepending renames. I havent taken the time to code anything up yet, but it seems pretty simple. Im not that great with batch and maybe someone here will run with this prepending file name with custom value added to prepend for you. I like adding a value and a underscore before the title of the song as for on the car stereo display it looks so much better than the value bound tight to the title like 2Paint it Black to me just looks too sloppy so add a underscore and make it look better. I guess I am picky that way. 

*Also to note, your method doesnt retain the order with different file names with an appended numbering system. Appended ordering only works with files of the same name. So if you want to keep the title of the song in the file name, its best to prepend a value to them. 

Locked out of editing last post, but did some quick searching and found this:   for f in *.md; do mv "$f" "test - $f"; done

This adds test - before every file name of all .md file extension files as indicated by the wildcard *.md

 If you had a batch in a loop with a counter you could pass the counter value within the "test - $f"; instruction and have 1 - 2 - 3 - 4 - and so on prepended until complete. However you wouldnt have any control of what files are in what order with a loop. But if prompted what to pass to this field, then maybe that would work to allow you to see what file is up at bat and give it a number for order that you want it placed with others.

http://superuser.com/questions/486465/how-to-mass-prepend-text-to-file-names Quote from: DaveLembke on NOVEMBER 11, 2016, 08:44:22 AM

Locked out of editing last post, but did some quick searching and found this:   for f in *.md; do mv "$f" "test - $f"; done

This adds test - before every file name of all .md file extension files as indicated by the wildcard *.md

 If you had a batch in a loop with a counter you could pass the counter value within the "test - $f"; instruction and have 1 - 2 - 3 - 4 - and so on prepended until complete. However you wouldnt have any control of what files are in what order with a loop. But if prompted what to pass to this field, then maybe that would work to allow you to see what file is up at bat and give it a number for order that you want it placed with others.

http://superuser.com/questions/486465/how-to-mass-prepend-text-to-file-names
This is BASH.   Unless Geek is running Windows 10 with the Linux Subsystem installed, this is not going to work.I need to clarify. The3 MP3 player is super dumb.  The only things it does is identify files as being audio files by the extension

My goal was to exclude a large block of files, not change the order
The player does not have a way to go to a  specific starting point. Expect by pressing the forward key N times.

Larger example, There are 100 audio files that a re just reading. Another 100 fioles are dance music. Another 100 are relaxing music.

So when I want to listen to the reading, I woulds exclude the music files.
So I I want to dance, I would exclude the files not in the category.
The order is not important. What matters is the kind of stuff I want to hear.

As for folders, the player does not respect folders. It plays anything that looks like a MP3 file. That is why I am think only the type matters.
Of curse, to make the change I have to plug the card into my PC, do a command, them put it back. The should not take 30 seconds.

As mentioned , the obvious solution is to just buy a lot of SD memory cards. But that just seems to be such a waste to have a bunch of chips that are mostly empty. So I am looking for a batch program that can just change the type for blocks of files The files can be in folders. Windows sees folders, the player only sees files.Lets say there are five folders.
\voice
\rock
\classic
\western
\soft
If I want the classic group., change the type of all the others.
Is that doable?



Gimme Shelter should be # 1...no matter what you guys figure out...I wonder if the player can see folders & files that have the hidden file attribute set.  This way you would not have to screw around with renaming files.OK, I will test that now. I have already found that it only knows MP3 and it does not care about sort order. It plays files b y the order they weer save. It does not stopwith folder boundaries. It just plays everything
I am going to try a test in Audacity.I will make a MP3 of my voice, write it to a USB drive and then make it hidden.
NO.
The player ignores the hidden bit. It plays the file as if the hidden thing did not matter.

Also, it only does MP3. It does not play WAV  files or even see them.

Given the l imitations of the device, as you've noted the extension is probably the way to go here- rename files to MP3 to make them "visible" rename them back to make them invisible to the player.

My thinking is using extensions  pl0, pl1, pl2, etc to .pl9. You would rename the files intending to be on each playlist with the appropriate extension, EG the first playlist to the pl0 extension, the second to the pl1 extension, etc.

you would have a batch file for performing the operation, and it is provided the desired playlist extension.

It's first task would be to find out the "current" playlist, since it would need to rename existing mp3 files back to the appropriate extension to hide them and tag them as part of that psuedo-playlist. I'm sure one of the more proficient batch guru's could do something more specific (maybe save it to a file for retrieval) but my thinking is to just brute force it to find the missing playlist extension, then rename all the mp3 files present back to that playlist extension. After that, the SD Card will have no files with the mp3 extension and the task is to rename the selected playlist files to Mp3 to make them "visible".

At that point we'd have the SD Card with no files with the mp3 extension, and the batch would just need to rename the selected playlist to "mp3" to make it active:
Code: [Select]for %%p in (0 1 2 3 4 5 6 7 8 9) do if not exist *.pl%%p rename *.mp3 *.pl%%p
rename *.%1 *.mp3




At which point your "selected" playlist is enabled. with the selected playlist being provided as a command LINE argument.

But of course having to open a command prompt and such doesn't make it particularly straightforward. If the player ignores all files that don't have a .mp3 extension, we can utilize that to make it a bit easier, and even make it somewhat machine independent. Let's say the above batch file is named "setplaylist.bat" and is saved on the SD Card. For easy selection you could create empty files with no extension where the name matches the playlist extension- for example there would be files pl1, pl2, pl3, etc. Then you could make use of the batch by dragging those files over the batch file in Windows Explorer.

For adding additional playlists beyond 10, it would require altering the "cleanup" logic in such a fashion as to recognize what playlist is "active" if there is one so it can rename the files back. Of course you can use longer than 3 characters so you could just go on with 10, 11, 12, etc and add it in there. (I'm sure there's room for a "for" command trick to iterate through say 100 numbers and have as many playlists as you want,  too, but I'm lazy and couldn't be bothered to look into that!)

It looks like you on to something here. I will have to think hard and see if I get it.
Meanwhile, here is a picture of the little MP3 player.

It has better sound than my smartphone.
But  is not smart. It is very dumb. 
1088.

Solve : How to read Floppy 1.44 compressed with Doublespace (1.8MB)?

Answer»

Hi to everyone,
I have an issue I need to recovery info from a floppy disk (1.44MB). This floppy was compressed with doublespace (in my opinion) and there is also a label on the floppy with this text: "1.8MB". UNFORTUNATELY who compressed floppy can not help me anymore. I have MS DOS 6 and 6.22 (bought in a flea market) emulated with vmware. I have TRIED a little bit but I need help to understand the right procedure that i must follow.

I hope that someone can help me because i'm not so good with MS DOS.

Thx in advance

RytxRytx, the compression issue can be a problem for anyone. Notice what the following has to say about the compression progrm once used.
Reference:
https://en.wikipedia.org/wiki/DriveSpace
Quote

Microsoft's decision to develop DoubleSpace and add it to MS-DOS was probably influenced by the fact that DOS-based operating systems from other manufacturers (IBM and Novell) had started including disk compression software in their products.[citation needed]
If you run into some troubles hard to understand, consult the above article. Because of some legal issue, the product could not continue to be offered by Microsoft. This lead to some problems.
In worst case, you will need the exact version number of MS-DOS and use that version to recover the data. However, the article above CLAIMS that you should not have any issue  if you use Windows 95. Myself, I don't know if that is true.
The article also states the Windows 98 can read the compressed files.

Another article about read files from a compressed floppy using Windows xp.
http://www.tomshardware.com/forum/81262-45-compressed-floppy

BTW: Older programs to handle compression wee written in the Real Mode. And that means you can not use them in 64 bit versions of Windows. Don't let this detail confuse you.
What files are on the disk?

A Doublespace or Drvspace compressed diskette/disk will contain files such as DBLSPACE.001 or DRVSPACE.001.

If it doesn't contain files like this it is not compressed.


Quote
"1.8MB". Unfortunately who compressed floppy can not help me anymore. I have MS DOS 6 and 6.22 (bought in a flea market)

Curious what you expect to find on the disk if and when you access the data and what you PLAN to do with the information?How does it show in Explorer when you open it ? ?
1089.

Solve : Type CMD in Explorer address bar?

Answer»

... to open a COMMAND window. I have been using Windows NT family since 1998 and I only just found out about this today! I am using Windows 10; how many versions back has this been possible?
Looks to work going back to Windows Vista; Windows XP, 2000, NT, 98SE (with command of course) etc. try to open it as a web page.Its been LIKE this for a while.

Some store kiosks years ago for example full screen to a browser and all other FEATURES blocked out use to allow this until they got better at keeping people out. 

I still like the Jump to URL "Feature" using Calculator to get a command prompt up and have had to use it before for white hat reasons to gain admin access to a troubled system that I wasnt given the admin password to, as WELL as the autorun on a CD trick to get to command prompt which from there I could type control and get control panel up and install a printer driver for a DIFFERENT printer for a Kiosk that otherwise I was locked out of when at my last career in IT for a Food Store but of which I wasnt given admin privileges by the Kiosk manufacturer.  Was able to swap out the printer with a different model with this local white hat hacking vs have to pay a crazy amount of money to the Kiosk manufacturer that refused to give up the admin password.

Here is the well known trick to get browser and command shell access through Explorer: http://techfunia.blogspot.com/2011/01/use-calculator-as-your-web-browser.html

From browser if there is no block at the browser, you then have full system access as whatever privilege the system is logged in as.https://wiert.me/2011/09/23/windows-device-manager-expand-all-nodes/

Didn't find this one til about a year ago...Oh that is fricken sweet and it opens up to the folder you were using in Explorer!!!!!

I always knew I could open up explorer from a cmd prompt by typing start .

Now I can go both ways!  (...I should probably delete that comment...)Naaah...we always knew that...
Quote from: Squashman on November 19, 2016, 12:00:47 PM

Now I can go both ways!  (...I should probably delete that comment...)
Fine by me, honey!
Quote from: Squashman on November 19, 2016, 12:00:47 PM
I always knew I could open up explorer from a cmd prompt by typing start .
You have saved me some typing because I have been using start "" "." for the last nearly 20 years.

From cmd prompt.
Open Explorer to the root of the current drive letter.
Code: [Select] start \or
Code: [Select]explorer \
1090.

Solve : Configure FreeDOS so I don't have to press Enter and choose drivers??

Answer»

Hello,

I DOWNLOADED FreeDOS website delted by allan(FreeDOS-1.1-memstick-2-2048M.img.bz2 was the one I chose) and put it on a USB drive. It works great, but the system is halted twice during the boot; first time it says press Enter to start FreeDOS, and second time I get three options about which drivers to load. Is there any way to bypass these stops? Any kind of setting so that it starts FreeDOS automatically and I don't have to press Enter, and then set it to automatically select option 1 when it asks about drivers?
I would like my FreeDOS to boot automatically without these halts.
Let me know if this is possible and what I would need to do. Thank you so much for reading!The main site for Free Dos:
http://www.freedos.org/

If that USB boot package is not working the way you want, you could CONSIDER some other USB boot package  for FreeDos.
This MIGHT help:
http://wiki.freedos.org/wiki/index.php/Main_Page
Quote

How do I install FreeDOS?
It's easy to install FreeDOS. To install, simply download the FreeDOS install CD image. Write this to a blank CD, and boot your computer with it. The automated install program should walk you through the REST. If you need help, please read the FreeDOS Install HOWTO (this is for VirtualBox, but should apply to any PC.)
Several computer VENDORS may pre-install FreeDOS on new computers or provide FreeDOS on CD-ROM.
Booting from a CD will prevent changes being made to the image.
1091.

Solve : Adapt a bat script?

Answer»

something I am doing bad :

echo off
taskkill.exe /im ditto.exe /f
START "C:\Program Files\Ditto\Ditto.exe"

I don't get reopen ditto. And the console opens and remain open.
What can i do
Best Regards
Is it killing your first instance of ditto?

Regardless of that you should use a set of empty quotes when quoting the path to the executable.

Code: [Select]START "" "C:\Program Files\Ditto\Ditto.exe" Quote

Is it killing your first instance of ditto?

Kind of confused as well to this... I can see someone putting in a goto and making a nasty kill/launch loop with this. However hopefully its just a reset for some reason we are not aware of.  I'll try and comment.

The purpose is a little bug i am suffering with Ditto and fast shortcuts Control+1 to 0 for the prior clips. I loose the order.
So I need to reiniatate the program sometimes to recover.
Goes fine.
But then I convert the bat file to an exe file.
the bat file execute the reopening opening and closing the console from ms-dos.
But the exe doesn't . How can i solve this

Perhaps an exit command under the last line ?

Best Regards
Quote from: Fielding on NOVEMBER 12, 2016, 12:55:26 PM
But then I convert the bat file to an exe file.
Why? This is unsupported, undocumented and likely to fail in many situations. Why do you need to do this?

Using which third-party tool?

Are you running the exe as administrator?
 
Is this squall?
Nahh...thankfully he never got as far as attempting coding...he concentrated on rescuing ancient equipment he found on tree lawns dumpsters etc...

However this may be his cousin.The batch scripting language is exactly that - designed so that text files containing commands are run by the interpreter in a carefully designed process (3 stages I( believe). Batch-to-exe converters have a bad reputation and are mainly used by script kiddies, not serious programmers. All they do is package the actual text of the script with an .exe stub. In my opinion, asking "why does my batch script work as a script but not when compiled by the BatWiz compiler?" takes one outside the SUPPORT zone for batch.
I try to explain.
I need to attach this script to the task bar.
The program i am using is : BAT2EXE from codeplex.

 

The more confusing this for me is that the script goes well under windows 7-64

Modifications I observe : the path now have space.
Quote from: Fielding on November 13, 2016, 12:13:36 PM
I need to attach this script to the task bar.
I wonder if you did this Google Search.

Which finds this as its first search RESULT.Squashman, you beat me to it! I thought of a shortcut to cmd.exe /c batchfile while I was in the shower. Quote from: Squashman on November 13, 2016, 02:13:50 PM
I wonder if you did this Google Search.

Which finds this as its first search result.

Sure that is not there some time ago when I use an old exe to pin to the task bar.
Thanks a lot
Best Regards
1092.

Solve : Cant run .bat while cmd itself works fine?

Answer»

Hello everyone, first of I have to say that English is not my mother language so there could be some mistakes.
Okay so I coudnt find any solution about this on internet or at least none of the 'fixes' helped me. Here is detailed thing about what happens when I launch .bat (check pic bellow),
Even though this is the simplest 'code':
echo off
echo Hello
pause
I get that error message everytime..
I dont know what to do anymore, I've tried to UPDATE java, to change ENVIRONMENT variables, even update registry with supposedly batchfix.reg FILE ( dont worry I've backuped registry before doing this) and none worked, I really hope you can help me out
P.S. I started hello.bat through cmd because when starting it by double click it starts cmd for a second showing this message and closes itself right after!

Im using win7 x64 sp1 pirated but still activated by license.
Thanks in advance

[attachment deleted by admin to conserve space] Quote from: Rapt0r on November 25, 2016, 04:03:50 PM

Im using win7 x64 sp1 pirated
Uh-oh.

Quote from: Salmon Trout on November 25, 2016, 04:40:03 PM
Uh-oh.
Wanted to say that Im not using a legit windows, it just downloaded version that is licensed, at least thats what it shows up on system info.Thee is not any reason to use a pirated version of Windows. (Except for a pirate.)
https://www.pcsteps.com/45-download-windows-7-iso-legally-free-digital-river/
A legal product key can be obtained at a very low costs for students and others who have special need.  In some cases it might be free.  Did you save the .bat file as a Unicode file by accident? Quote from: Squashman on November 25, 2016, 08:54:00 PM
Did you save the .bat file as a Unicode file by accident?
Thank you so much! Yes, that was the problem!
Im using cyrilic latter and sometimes when I write a document it removes 'special latters'  so I set unicode by default.
I was also tempted to reinstall OS because I really thought that's the problem....
Once more THANKS A LOT Squashman!The SCREEN shot you took was the dead give away because of the character before the .
1093.

Solve : Remove header from multiple csv files using batch file?

Answer»

I have TWO files in a FOLDER file1.csv and FILE2.csv that contain the data. file1.csv with column names name and sal and file2.csv with the same column names name and sal. required header columns are present in headerfile.csv in the same folder and the column names are ename and esal. My requirement is to replace headers in file1 and file2 with headers from headerfilePlease provide a real WORLD example of your input and how you want the OUTPUT to look like.

1094.

Solve : batch file for tracert?

Answer»

Hi,

Can someone help me creating a tracert batch file which run conti after 1 or 3 hr and print tracert report with different file name & date, TIME stamp, so that previously created tracert report not get merged.Your question doesn't have all the details but see if this works for you:

Code: [Select]echo off
:loop

for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"

set "datestamp=%YYYY%%MM%%DD%" & set "TIMESTAMP=%HH%%Min%%Sec%"
set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%"

tracert www.google.com >"%fullstamp%.txt"

goto :loop
Thx for quick response...

but please suggest where i have to put hours like 1, 2 or 3 after that this batch file auto execute and create different log file from the PREVIOUS one.Explain what you need to do again.we want to create a batch file that -

1. Should run automatically after 3 hours
2. will run tracert & print out their RESULTS with date & time.
3. when same batch run after 3 hour then it should create another file for that tracert report with date & time.

I hope now I have explained it.Use Windows Scheduled Task to run the Batch file every 3 hours.Thanks guys... its really worked like a charm  Quote from: foxidrive on May 07, 2014, 08:32:49 AM

Your question doesn't have all the details but see if this works for you:

Code: [Select]echo off
:loop

for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"

set "datestamp=%YYYY%%MM%%DD%" & set "timestamp=%HH%%Min%%Sec%"
set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%"

tracert www.google.com >"%fullstamp%.txt"

goto :loop
I know its an old thread, but for me it didn't worked untill I did this:
Code: [Select]echo off
cd A:\NY\Directories\You\Want\Your\results\In
:loop

for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"

set "datestamp=%YYYY%%MM%%DD%" & set "timestamp=%HH%%Min%%Sec%"
set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%"

tracert www.google.com >"%fullstamp%.txt"

goto :loop
With the original code, it created about 3-4 empty files PER seconds in the same directory.
I am on Windows 7 64bit.
1095.

Solve : Problem using batch script?

Answer»

hi, i am new user of windows batch script. I am having problem to write a script to automate the repetitive programme. In the batch script, I need to the replace the input filename by another filename, can it be read directly from the filename itself or we do need to specify in the script? Because there are a lot of files, I can't specify ONE by one. Anyone can help?
Thank you.Are you saying you have a list of file names you need to process with a program?

Please post any code you have so far so we can understand the context of what you are trying to accomplish.ECHO off &setlocal
set "SEARCH= "xyz"
set "replace="abc"
set "textfile=text123.txt"
set "newfile="text321.txt"


(for /f "delims=" %%i in ('findstr /n "search" "%textfile%"') do (
    set "LINE=%%i"
    setlocal enabledelayedexpansion
    set "line=%line:xyz=abc%"
    echo(%line%
    endlocal
))>"%newfile%"

Thanks for your reply, Squashman. This is the code I am still trying on. YES, I have a list of filenames which need to goes through the same process, so required to replace the filename in the batch one by one and produce a bunch of output files. Is it possible to do that? I've tried to replace just the filename in the script and save to a new file but it is failed. Can you help me on these? I have no idea how the batch script work and still trying hard to learn. Thank you.

1096.

Solve : PASSING VARIABLES BETWEEN BAT FILES?

Answer»

I'm attempting to execute a bat file which SETS a variable and then have that
variable available to a second bat file. So I set up a test..
TEST0-BAT.BAT RUNS  TEST1-BAT.BAT WHICH IN TURN RUNS TEST2-BAT.BAT

My issue is I'm not getting anything in TEST1-BAT for the variable - Timestamp3
which is set in TEST2-BAT.BAT. The echo stmts. in TEST2-BAT appear to show all
variables are set correctly,

I'm running WIN. 10 XP.

Anyone have any ideas / advice ?

thanks


TEST0-BAT CONTAINS:
   TEST1-BAT.BAT > TEST1-BAT.OUT 2> TEST1-BAT.ERR

TEST1-BAT.BAT CONTAINS:
   TEST2-BAT    > TEST2-BAT.OUT 2> TEST2-BAT.ERR
   FOR /F "tokens=*" %%i IN ('TEST2-BAT.bat') DO set Timestamp3=%%i
   echo %Timestamp3%
   ren testX.txt "TESTX-%Timestamp3%.txt"

   
TEST2-BAT CONTAINS:
   echo off
   cls
   echo Date format = %date%
   set "dd=%date:~7,2%"
   set "mm=%date:~4,2%"
   set "yyyy=%date:~10,4%"
   echo.
   echo Time format = %time%
   set "hh=%time:~0,2%"
   set "min=%time:~3,2%"
   set "ss=%time:~6,2%"
   echo.
   echo Timestamp1 = %date:~7,2%_%date:~4,2%_%date:~10,4%-%time:~0,2%_%time:~3,2%_%time:~6,2%

   echo Timestamp2 = %date:~7,2%-%date:~4,2%-%date:~10,4%-%time:~0,2%_%time:~3,2%_%time:~6,2%

   set Timestamp3=%dd%-%mm%-%yyyy%_%hh%-%min%-%ss%

   echo Timestamp3 = %Timestamp3%
Fix your capslock 1st...How about using the BB code tags.I'm fairly new to DOS..... so I have no idea what your reference to 'fix your capslock 1st'  MEANS...

Be that as it may... I've done more testing and have solved my issue... thanks Quote from: BRIANH on January 05, 2017, 03:38:04 PM

I have no idea what your reference to 'fix your capslock 1st'  means...
He means it is bad manners to type all in capital letters, as you did in the thread title. Doing that is the web equivalent of shouting (e.g. for attention). This has been so for around 20 years if not more.

1097.

Solve : CDR101 not ready reading on DOS 6.22?

Answer»

Hello,

I want to start by saying that I have searched for this topic everywhere and could not find help for my specific problem. Also, I am not well VERSED in computers. I am working with a NIXSYS NX-i90 system, NX853 Intel p4 CPU Motherboard with Legacy OS Support and MS DOS 6.22. This computer was custom made to work with an older instrument my research group USES. I had to install a cd-rom drive and the driver to go with it. I am pretty sure I did this correctly as, when I turn on the computer, it recognizes the cd drive and it recognizes the cd when inserted.

The problem I am having is when I try to install the instruments software onto the computer. I have a cd with the backup files that I extracted and I am only able to copy some of them to the hard drive, it stops at a point and the prompt "CDR101 not ready reading" comes up, this is followed by a question to abort, fail, or end? I really don't know what is going on, I have checked all the cables and they seem to be connected properly, I am able to access the D:\ drive and the cd-rom drive is recognized, so I don't think the drive is bad, the only thing I can think is that I am installing the backup files incorrectly? Again I cannot find much help with this issue, my schools IT department is not versed in DOS, so I thought I would try a forum.

Any help will be greatly appreciated. Please let me know if you need more information.

Thank you for your time
Sam
I would try to determine if the failure to transfer data is due to the disk or the drive. Can you copy all of the disk contents by inserting it into a modern computer's optical drive and trying to copy the disk contents to a folder on that PC's hard drive? If this gives an error, inspect the disk carefully for blemishes, scratches, dirt, etc. if you decide to clean it, do so very carefully, especially if this is your only backup  disk. if the disk is really old, it may have deteriorated. If a copy operation is successful, you could try BURNING another disk.

Is the CD-ROM drive a known good one? If it is old, maybe use of a lens cleaning disk could be worth a try. Or a different drive.

I presume it is an IDE drive? You should inspect the data cable carefully for signs of damage such as cracking. Are the connectors fully inserted? If it is an 80-wire cable try a 40-wire one. In any case try to find a different cable. Grab the OakRom CD drivers...and follow This guide...Thanks for the input. I will try the suggestions and reinstalling the driver using the OakRom CD driver and let you know how that works.
Bring us good news on that old dinosaur... No good news as yet. I am thinking my problem is my cd drive. The model is a SONY dru-190a. I think this is an atapi drive not an ide, though I really don't know the difference between these drives. Could this be the reason I am having trouble? Now I am having a hard time finding a good driver to use. I tried the oakrom cd driver, but had no luck. The bios still shows the cd drive as being there but I cannot access the drive itself.
I don't know if anyone has other ideas. I will be trying another cd drive in the next few weeks, but I just WANTED to give an update. This is a project I am working on after my others so it may be a while before I spend a lot more time on this.
Thanks for the help so far
SamEvery "IDE" CD-ROM drive is an ATAPI drive.

How are you trying to use the OAKCDROM.SYS driver? You need to both include a DEVICE or DEVICEHIGH command in config.sys as well as make the device accessible through MSCDEX.EXE.

config.sys:
Code: [Select]DEVICE=C:\OAK\OAKCDROM.SYS /D:OAKCD

autoexec.bat:
Code: [Select]MSCDEX /D:OAKCD
I did that for the config.sys and autoexec.bat, but when I insert the cd and try to access the d drive, it says it's not specified. If you watch the b oot sequence when it loads MSCDEX it should indicate what drive letter it was assigned to.

You'll have to provide the specific command you entered and the exact error message you receive.

May I ask why he wants to have a CD with DOS 6.22?
That OS was intended for diskette drives.
DOS 6.22 does not have a need for a CD-ROM.

EDIT: He could use a modified DOS 6.22 that has CD support built-in.
https://www.youtube.com/watch?v=8fH9lDcpo9c
A MS DOS 6.22 CD ISO  is found in various placers.
Quote from: Geek-9pm on December 13, 2016, 12:13:13 PM

May I ask why he wants to have a CD with DOS 6.22?
That OS was intended for diskette drives.
DOS 6.22 does not have a need for a CD-ROM.

he's not attempting to run DOS from CD...re-read the Post.
Patio, id did  read and re read.
He stated his project on the left foot.
He should have stated on the right foot.
The right foot would be to use a OS that  has CD-ROM support already.
DOS 6.22 on a CD has built-in CD om support. On version I have used boots DOS 6.22 from a CD and does not use any hard drive space. No drivrs needed, not install needed, no hassle.
But then, the OP did not say what he had in mind as a objective. Maybe he wanted to make something easy into something hard.
Here is how to run DOS from a CD with not hard drive install needed.
http://www.computing.net/answers/windows-xp/how-to-create-bootable-msdos-622-cd/185071.html

The above is a set of post from some who say you can't do it that way. But you can. It was done some time ago and documented and everybody forgot about it.

Do you mean booting with a CD to install DOS 6.22?
Or do you merely want to create a DOS 6.22 bootable CD?

This is where every body gets stuck. No, it is about running DOS from a bootable CD, not about installation.
He has DOS up and running...he needs to get the CDROM working for an app that needs it...

I read that entire link and didn't see where anyone made a DOS bootable CD with built in CDROM support BTW...

2 of the alternate links within that link you posted are dead ends BTW.Smatthew...just thought of something...
If after trying the OakRom drivers the drive didn't work...correct ? ?

If a Work enviornment it's possible the drive is on it's way out...

Quote
I am only able to copy some of them to the hard drive, it stops at a point and the prompt "CDR101 not ready reading" comes up, this is followed by a question to abort, fail, or end?

This is what got me thinkin along those lines...You can make a CD that has two partitions, a small one is an image of an MS-DOS, FreeDOS etc boot floppy with CD-ROM support, and would appear as Drive A:, the larger one is what MS-DOS sees as the CD-ROM drive letter. of course this depends on the TARGET machine BIOS being able to support floppy emulation.
Typical guide here using the "El Torito" method
http://www.styma.org/bootcdrom/bootcdrom.shtml

https://en.wikipedia.org/wiki/El_Torito_(CD-ROM_standard)

1098.

Solve : How i can compress subdirectory and move to other disk??

Answer» HEY guys

i am using RAR.exe
and cobian backup program..
cobian running hourly my batch file for backup copy (my DBF files and index files) to created backup dir with timestampped

backup directory is...
c:\Backup\Data

my sub directory name style
SUB1_2016_%date%_%time%
SUB2_2015_%date%_%time%
...

cobian creating new backup hourly with my batch copy files..
why copying? cant create compressed files with cobian on users working (24h program working)

what i will do?
i will add new session to cobian daily.
i will do all subdirectory will compress with RAR.exe
and i will move to all rar files to external disk is path e:\Data\
and i will delete subdirectory after move rar files... or
if i can do delete compressed subdirectory will be good.. but dont know rar parameters on command lines

todays i am making everythings with manual after cobian hourly backup

thxSo you want to have hourly backups of your database and store them compressed to save space, and people are using this database while you want to back it up at the same time. THATS tricky. I have worked with mySQL before and its best that no database transactions be happening while the database is being backed up. Reason behind this is that you could be backing up a partial transaction. Partial transaction is when the database is being backed up and at the same time someone is making CHANGES to it, adding entries, changing values etc, and the backup and transaction of the user conflict to where only some of the data that they entered or changed is saved under that backup interval. For whatever transaction is happening during the backup you have the potential for corruption if you ever went to restore the database from this saved state in which there is only a partial of all data that was manipulated during that transaction and backup overlap.

Safest method would be to have a MIRROR database going on at the same time, the mirror database that clones the data of the actual database at a timed interval where you create your hourly backups off of. This other database does not have transactions with users and so the only time transactions happen are when it calls to replicate its database with that of the master database that everyone interacts with. This is the method I would go with to avoid a transaction occurring while the backup is happening. Transactional databases are pretty bulletproof but a backup at the same time that its in use, I try to avoid personally.

When i worked for a food store I had a setup like this where a mirror of the database updated every 15 minutes so that the maximum data loss was for a 15 minute span. I never went with hourly backups but could have if I wanted to. We just ran a daily backup after midnight for the start of the next day. We had the master go down hard when RAID set broke once and I was able to restore the master from the mirror in under 10 minutes over 100mbps network connection. Ran a SQL DUMP and then pushed the AllDatabases dump file to the fixed master.

http://mysqlserverteam.com/creating-and-restoring-database-backups-with-mysqldump-and-mysql-enterprise-backup-part-1-of-2/Hello Dave

using foxpro dos dbf files...

mean... cant do export.. only copy... or disconnect all users for backup

i am copying files with copy command on dos screen
after i need auto compress files and wanna move to external usb disk
weekly i am changing disk for security but... only hourly copy auto with cobian program
others.. compress and move doing manuely

i need new batch for compress after move to usb

i am not coder.. sorrySub-directory backup may be the issue here...
1099.

Solve : Echo file date?

Answer»

Modifying some code I found.  Basically I am parsing a directory and subdirectory filelist out after a date and writing the INFO to a text file to use as input into 7 zip.  I was going to use forfiles when I found out that one can not exclude directories when using -s.  My problem is echoing out the file date using echo %%~tF.  I get a BLANK line.  or with other variants I get the colon . I am missing something here.  I got stuck on the echo.

Current version of code:

echo off
for /D %%D in ("c:\Docs\*.*") do (
    if /I not "%%D"=="c:\docs\outlook data files" (
::store current directory
        pushd "%%D"
::recurse through directory for file
        for /R %%F in (%%D) do (
 
   echo ok
 echo :%%~tF
         
        )
        popd
    )
)

The version gives:

ok
:
ok
:

Ultimately, I want to add an if to compare the file date to a date I specify and if >= echo file to the file list using something like : ECHO PATH\FILE>> "c:\test\ziplst.txt"Quick SANITY check... you want to find a folder under C:\Docs, called "C:\Docs\outlook data files", (which WILL be present?) and then echo the date and time of every single file in that folder, preceding each date with a colon? Is that right?



PLEASE use code tags.I initially looked under Help and Posting for how to insert code before posting.  I looked for some other general stickies, couldn't find one though. Help had a lot of stuff on POLLS, nothing on posting inline code in Posting.   Do you have a code tag format link?

Search seemed to be dyfunctional.  Perhaps I do not understand how to use the Search.  I did a search on batch and date and one on just date, got nothing returned yet in just going through the forum pages found a couple of threads on batch and date.. you want to find a folder under C:\Docs, called "C:\Docs\outlook data files"

C:\Docs\outlook data files   gets excluded from the search since there is a not in the compare.  %%D has current path & filename.  Started over and now have different problem.  FileDate var is getting set to last file's date in the Echo for all files.


Code: [Select]for /R "C:\test\" %%D in (*.*) do (
set FileDate=%%~tD
ECHO %%D:  CurFDate: %%~tD:    %FileDate:~0,10%  >>I:\tem.txt

)


output:

C:\test\t1.dat:  CurFDate: 10/15/2014 02:26 PM:    11/11/2014 
C:\test\t2.dat:  CurFDate: 10/15/2014 02:34 PM:    11/11/2014 
C:\test\t3.txt:  CurFDate: 11/16/2015 10:42 AM:    11/11/2014 
C:\test\t4.txt:  CurFDate: 12/31/2015 08:53 AM:    11/11/2014 
C:\test\t5.txt:  CurFDate: 05/11/2016 02:20 PM:    11/11/2014 
C:\test\TestL2\t6subd.dat:  CurFDate: 11/11/2014 01:56 PM:    11/11/2014  Because you are not using delayed expansion.

1100.

Solve : Select files and enter?

Answer»

I want to automate opening multiple files.

I can press CTRL-A, then Enter, but I want to put these two commands into a batch file to do it with one step.

I use a macro creation program called JitBit Macro Recorder in which I can do whatever I want and compile it as an exe and then CALL to the exe to run and run for so many TIMES and end or a loop until hot key to end it is run etc. You can record you activity and play it back or you can go in and manually program the list of steps and time delays etc. Very easy to use, but its not a free program. I bought it about 8 years AGO and whats cool is that the license is a lifetime license. I contacted them after activating the latest version and they e-mailed me a key that would work with the latest version when I proved that I OWNED a legal copy of their software from 8 years ago and showed proof of purchase since I saved the purchase info.

https://www.jitbit.com/macro-recorder/

There are some free macro recorders out there to play macro'd events but the free ones I have had bugs with, so I decided to pay money for one that was well supported and far lesser bugs.Thanks, I'll give it a try