You are not logged in.
Pages: 1
Hey guys. I am trying to write a simple script that can run all the exe files in this ms update folder I have
@echo off
title MS Updates
setlocal enabledelayedexpansion
ECHO.
ECHO Update Files
set counta=1
for /f "usebackq tokens=*" %%g in ('dir /b "*.exe"') do (
set _update!counta!=%%~g
set /a counta+=1
"%cd%\%%g" /norestart /passive 2>nul >nul
)
What am I doing wrong here. Thanks
cmd, vbs, ps, bash
autoit, python, swift
Offline
Whats the actual error?
if you change the last line to
ECHO "%cd%\%%g" /norestart /passive
What do you see?
Offline
Hey Simon
I fixed it by changing the code . I am just curious about the whole usebackq syntax, sometimes it is not neccesary
@echo off
title MS Updates
setlocal enabledelayedexpansion
ECHO.
ECHO Update Files
set counta=1
for /f "tokens=*" %%g in ('dir /b "*.exe"') do (
set _update!counta!=%%~g
set /a counta+=1
echo %%g
"%cd%\%%g" /norestart /passive 2>nul >nul
)
Last edited by NDog (25 Aug 2007 07:07)
cmd, vbs, ps, bash
autoit, python, swift
Offline
It certainly has its place and is most useful when you want to specify multiple input files (where the paths contain one or more spaces) as your "file-set".
The reason your initial script didn't work was because you used normal quotes ' instead of back quotes ` on your DIR command.
Last edited by bluesxman (03 Sep 2007 12:13)
cmd | *sh | ruby | chef
Offline
Pages: 1