Post Reply 
[How to] Help with a Batch File Command
Author Message
justMongo Offline

Monitors

Posts: 3,847
Joined: Sep 2013

Machine: ResMed VPAP Auto (S9)
Mask Type: Full face mask
Mask Make & Model: ResMed Mirage Quattro
Humidifier: ResMed H5i
CPAP Pressure: 18 IPAPmax - 11 EPAPmin, PS=5
CPAP Software: Other Software

Other Comments: μολὼν λαβέ

Sex: Male
Location: Калифорния

Post: #1
Question Help with a Batch File Command
I'm working on a batch file for my WIN 7 machines.

I am having trouble with one line. It worked before I tried to add the IF EXIST test. Now, it seems to be ignoring the switches; and deletes only the files, not the folder tree.

What is wrong with this line?

IF EXIST "C:\Users\%USERNAME%\Documents\DUMMY FILE" (ERASE "C:\Users\%USERNAME%\Documents\DUMMY FILE" /F /S /Q)

INFORMATION ON APNEA BOARD FORUMS OR ON APNEABOARD.COM SHOULD NOT BE CONSIDERED AS MEDICAL ADVICE. ALWAYS SEEK THE ADVICE OF A PHYSICIAN BEFORE SEEKING TREATMENT FOR MEDICAL CONDITIONS, INCLUDING SLEEP APNEA. INFORMATION POSTED ON THE APNEA BOARD WEB SITE AND FORUMS ARE PERSONAL OPINION ONLY AND NOT NECESSARILY A STATEMENT OF FACT.
02-13-2015 12:22 PM
Find all posts by this user Post Reply Quote this message in a reply

Donate to Apnea Board
eplantz Offline

Preferred Members

Posts: 46
Joined: Mar 2013

Machine: S9 AutoSet
Mask Type: Nasal pillows
Mask Make & Model: Airfit P10
Humidifier: H5I
CPAP Pressure: 15-20
CPAP Software: SleepyHead

Other Comments:

Sex: Male
Location: Chicago

Post: #2
RE: Help with a Batch File Command
RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path

/S Removes all directories and files in the specified directory
in addition to the directory itself. Used to remove a directory
tree.

/Q Quiet mode, do not ask if ok to remove a directory tree with /S
02-13-2015 12:52 PM
Find all posts by this user Post Reply Quote this message in a reply
Crimson Nape Offline

Monitors

Posts: 1,327
Joined: Oct 2014

Machine: ResMed S9 Autoset
Mask Type: Other
Mask Make & Model: P-10 / F&P Simplus / DreamWear
Humidifier: H5i w/Climateline
CPAP Pressure: 8 - EPR 3
CPAP Software: SleepyHead

Other Comments: CMS-50F & 50IW

Sex: Male
Location: Georgia

Post: #3
RE: Help with a Batch File Command
Have you tried:
DEL /F /S /Q /A "C:\Users\%USERNAME%\Documents\DUMMY FILE\*"

I think I'd play with this command with a dummy directory/file setup. Based off of what you listed, it is very possible to accidentally delete your My Documents Directory

Statistics prove that people who have more birthdays live longer.
02-13-2015 01:13 PM
Find all posts by this user Post Reply Quote this message in a reply

Donate to Apnea Board
justMongo Offline

Monitors

Posts: 3,847
Joined: Sep 2013

Machine: ResMed VPAP Auto (S9)
Mask Type: Full face mask
Mask Make & Model: ResMed Mirage Quattro
Humidifier: ResMed H5i
CPAP Pressure: 18 IPAPmax - 11 EPAPmin, PS=5
CPAP Software: Other Software

Other Comments: μολὼν λαβέ

Sex: Male
Location: Калифорния

Post: #4
RE: Help with a Batch File Command
(02-13-2015 01:13 PM)sgearhart Wrote:  Have you tried:
DEL /F /S /Q /A "C:\Users\%USERNAME%\Documents\DUMMY FILE\*"

I think I'd play with this command with a dummy directory/file setup. Based off of what you listed, it is very possible to accidentally delete your My Documents Directory

Hence the name DUMMY FILE. I have it in a test BAT file and am actually targeting a dummy folder that I put so junk folders and files in.

INFORMATION ON APNEA BOARD FORUMS OR ON APNEABOARD.COM SHOULD NOT BE CONSIDERED AS MEDICAL ADVICE. ALWAYS SEEK THE ADVICE OF A PHYSICIAN BEFORE SEEKING TREATMENT FOR MEDICAL CONDITIONS, INCLUDING SLEEP APNEA. INFORMATION POSTED ON THE APNEA BOARD WEB SITE AND FORUMS ARE PERSONAL OPINION ONLY AND NOT NECESSARILY A STATEMENT OF FACT.
02-13-2015 01:49 PM
Find all posts by this user Post Reply Quote this message in a reply
Crimson Nape Offline

Monitors

Posts: 1,327
Joined: Oct 2014

Machine: ResMed S9 Autoset
Mask Type: Other
Mask Make & Model: P-10 / F&P Simplus / DreamWear
Humidifier: H5i w/Climateline
CPAP Pressure: 8 - EPR 3
CPAP Software: SleepyHead

Other Comments: CMS-50F & 50IW

Sex: Male
Location: Georgia

Post: #5
RE: Help with a Batch File Command
OK, Basically the only thing that I added to your code was the addition of "\*" at the end of your command.

Statistics prove that people who have more birthdays live longer.
02-13-2015 02:02 PM
Find all posts by this user Post Reply Quote this message in a reply

Donate to Apnea Board
justMongo Offline

Monitors

Posts: 3,847
Joined: Sep 2013

Machine: ResMed VPAP Auto (S9)
Mask Type: Full face mask
Mask Make & Model: ResMed Mirage Quattro
Humidifier: ResMed H5i
CPAP Pressure: 18 IPAPmax - 11 EPAPmin, PS=5
CPAP Software: Other Software

Other Comments: μολὼν λαβέ

Sex: Male
Location: Калифорния

Post: #6
RE: Help with a Batch File Command
It appears that the RMDIR command should be used. But, it will get stuck on hidden files.
The DELTREE command is obsolete.
I may have to use both ERASE with switches, then RMDIR.
The /F switch on ERASE deletes hidden files.

INFORMATION ON APNEA BOARD FORUMS OR ON APNEABOARD.COM SHOULD NOT BE CONSIDERED AS MEDICAL ADVICE. ALWAYS SEEK THE ADVICE OF A PHYSICIAN BEFORE SEEKING TREATMENT FOR MEDICAL CONDITIONS, INCLUDING SLEEP APNEA. INFORMATION POSTED ON THE APNEA BOARD WEB SITE AND FORUMS ARE PERSONAL OPINION ONLY AND NOT NECESSARILY A STATEMENT OF FACT.
02-13-2015 02:25 PM
Find all posts by this user Post Reply Quote this message in a reply
DariaVader Offline
Apnea Board Facebook Editor
Monitors

Posts: 1,820
Joined: Nov 2014

Machine: Resmed S9 AutoSet
Mask Type: Nasal pillows
Mask Make & Model: Airfit P10 for Her
Humidifier: H5i humidifier with ClimateLine heated hose
CPAP Pressure: 8-15
CPAP Software: SleepyHead

Other Comments: diabetes II, Thyroidectomized, Primary Immune Deficiency, and the list goes on :P

Sex: Female
Location: Oregon

Post: #7
RE: Help with a Batch File Command
yummmmm batch files.... I gave them up and went bash Smile

هههههه هههههه هههههه هههههه هههههه هههههه هههههه هههههه هههههه هههههه هههههه هههههه هههههه هههههه
Tongue Suck Technique for prevention of mouth breathing:
  • Place your tongue behind your front teeth on the roof of your mouth
  • let your tongue fill the space between the upper molars
  • gently suck to form a light vacuum
Practising during the day can help you to keep it at night

هههههه هههههه هههههه هههههه هههههه هههههه هههههه هههههه هههههه هههههه هههههه هههههه هههههه هههههه
02-13-2015 02:30 PM
Find all posts by this user Post Reply Quote this message in a reply

Donate to Apnea Board
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  File Hash check program justMongo 3 200 10-14-2016 01:32 AM
Last Post: srlevine1
  what's wrong with this fragment of windows batch code? justMongo 18 1,802 09-16-2015 10:46 AM
Last Post: AlanE

Forum Jump:

Who's Online (Complete List)