Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

batch file help

Featured Replies

i wonder if you could help me with this batch file. The issue i am having is i want the file to delete itself after it has preformed its function. I have been able to do this before but i can no longer get it working.

@echo off

SET D=%SYSTEMROOT%\system32\
REM delete oeminfo.ini if exists
IF EXIST "%D%oeminfo.ini" DEL "%D%oeminfo.ini" /q
FOR %%d IN (c: d: e: f: g: h: i: j: k: l: m: n: o: p: q: r: s: t: u: v: w: x: y: z:) DO IF EXIST %%d\WIN51IP SET CDROM=%%d


echo [General] >> "%D%oeminfo.ini"
echo Manufacturer=Unattended Windows Install >> "%D%oeminfo.ini"
echo Model=" Version: (09.18.07)" >> "%C%oeminfo.ini"
echo [Support Information] >> "%D%oeminfo.ini"
echo Line1=Installation Date: %date% >> "%D%oeminfo.ini"
echo Line2= >> "%D%oeminfo.ini"
echo Line3=Slipstreamed Hotfixes:>> "%D%oeminfo.ini"
echo Line4= >> "%D%oeminfo.ini"

REM Line Number
SET i=5

REM List slipstreamed fixes
For /F "TOKENS=1 delims=.CA_" %%j in ( 'dir /B %CDROM%\I386\svcpack\KB*.CA_' )do ( ( set kbname=%%j ) & (call :myprint) )
For /F "TOKENS=1 delims=.CA_" %%j in ( 'dir /B %CDROM%\I386\svcpack\IE7*.CA_' )do ( ( set kbname=%%j ) & (call :myprint) )
For /F "TOKENS=1 delims=.CA_" %%j in ( 'dir /B %CDROM%\I386\svcpack\WMP11*.CA_' )do ( ( set kbname=%%j ) & (call :myprint) )
GOTO :NEXT

:myprint
echo Line%i%=%kbname% >> "%D%oeminfo.ini"
SET /A i+=1

:NEXT

DEL /F "%UserProfile%\Desktop\Cleanup.cmd"

Edited by Yzöwl


The answer you are looking for is

@ECHO OFF&SETLOCAL ENABLEEXTENSIONS
SET "d=%SYSTEMROOT%\SYSTEM32\oeminfo.ini"
FOR /F %%? IN ('MOUNTVOL^|FIND ":\"^|FIND /V "A:\"') DO (
IF EXIST %%?WIN51IP SET "CDSPDIR=%%?I386\SVCPACK")
IF NOT DEFINED CDSPDIR GOTO ENDIT
>"%d%" (ECHO/[General]
ECHO/Manufacturer=Unattended Windows Install
ECHO/Model=" Version: (18.09.07)"
ECHO/[Support Information]
ECHO/Line1=Installation Date: %DATE%
ECHO/Line2=
ECHO/Line3=Slipstreamed Hotfixes:
ECHO/Line4=)
SET n=4
PUSHD %CDSPDIR%
FOR /F "DELIMS=" %%? IN ('DIR/B/A-D *.CA_^|FINDSTR/IB "KB IE7 WMP11"') DO (
CALL :ADDIT %%~n?)
POPD&GOTO ENDIT
:ADDIT
SET/A n+=1
>>"%d%" ECHO/Line%n%=%1
GOTO :EOF
:ENDIT
ENDLOCAL&DEL %0

I haven't tested it, but I'm fairly sure it should work for you.

Maybe stupid question :blushing: , but does the file resides in %UserProfile%\Desktop\ ?

Personally I would use "%~dpnx0"

Other possibility, it is a timing problem of some kind. :unsure:

If this is the case, you may want to try a loop similar to the one detailed here:

http://www.catch22.net/tuts/selfdel.asp

BTW, you seem to be missing a GOTO :EOF to return from the calls in FOR loops. :blink:

jaclaz

EDIT: Sorry Yzöwl, cross-posting.

Edited by jaclaz

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.