Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can you execute any DOS command within a VFP prg?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00494133
Message ID:
00494138
Vues:
21
>I thought that I had read that you can execute any DOS command within VFP. Is that true? would like to do a XCOPY and an ATTRIB with a /s switch
>
>Brenda

Here's the source on a prg to move old phone logs into history directories and distribute new phone logs to current directories:
*-*** move files around
*-*** move to history
curpath = SYS(5)+SYS(2003)
USE DirPaths EXCL
SET ORDER TO TAG DirPath
** get the last month
IF VAL(monthtoprocess) <> 1
	month1 = VAL(monthtoprocess) - 1
ELSE
	month1 = 12
ENDIF
month1 = SUBSTR(CMONTH(CTOD(STR(month1)+"/01/"+STR(YEAR(DATE())))),1,3)
* copy last months phone.num files to OLD directory
SCAN
	* DirPath already contains a leading backslash
	mcopy = curpath +(ALLTRIM(DirPath))+ "\*.*  to " + curpath+"\old\" + ;
		ALLTRIM(month1)+"\"+(ALLTRIM(DirPath))
	COPY FILE &mcopy
ENDSCAN
** unmark  read only
mflag = "flag " + curpath + "\*.* -ro /c /s"
!&mflag
IF NOT USED('Phone')
	SELECT 0
	USE phone
ELSE
	SELECT Phone
ENDIF
SET ORDER TO TAG KeyFld
IF NOT USED('DirPaths')
	SELECT 0
	USE DirPaths
ELSE
	SELECT DirPaths
ENDIF	
SET ORDER TO TAG KeyFld
GO TOP
DO WHILE NOT EOF('DirPaths')
	** delete existing phone.num files from DirPath
	mdel = (curpath + ALLTRIM(DirPaths.DirPath) + "\*.*")
	DELETE FILE &mdel
	* now copy new phone.num files from \phone#\phone.num to DirPath
	* the files are new because the fonebill program was previously run
	SELECT phone
	=SEEK(KeyFld,'Phone','KeyFld')
	DO WHILE phone.KeyFld = DirPaths.KeyFld  .AND. NOT EOF('Phone')
		mcopy  = curpath + "\phone#\" + phonenumbe + " to " + ;
			curpath + ALLTRIM(DirPaths.DirPath)
		COPY FILE &mcopy
		SKIP
	ENDDO
	SELECT DirPaths
	SKIP
ENDDO
mflag = "flag " + curpath + "\*.* +ro /c /s"
You can also use the VFP "RUN" command, as described in the help.
JLK
Nebraska Dept of Revenue
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform