run a batch file from fwh
- Silvio.Falconi
- Posts: 7133
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
run a batch file from fwh
I need to start a batch file that has only one command line from an exe fwh
in the command line enclosed in the bat file it wants three parameters %1 %2 %3
instead of these three parameters the information contained within a dbf must be linked
example
First, Last, Address
any help pls
in the command line enclosed in the bat file it wants three parameters %1 %2 %3
instead of these three parameters the information contained within a dbf must be linked
example
First, Last, Address
any help pls
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- Marc Venken
- Posts: 1485
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: run a batch file from fwh
I would generate/update the bat file itself with the dbf data, just before running it from FWH.
Marc Venken
Using: FWH 23.08 with Harbour
Using: FWH 23.08 with Harbour
- Silvio.Falconi
- Posts: 7133
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: run a batch file from fwh
perhaps I resolved
I created a txtfile from fwh
and then save as "xxx.bat"
then I make run this bat
But there is a problem because the command I insert on it need level administrator because there is a command NET USER
I created a txtfile from fwh
and then save as "xxx.bat"
then I make run this bat
But there is a problem because the command I insert on it need level administrator because there is a command NET USER
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- Silvio.Falconi
- Posts: 7133
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: run a batch file from fwh
sample :
this created the file .bat
then it is no executed why ?
if you run cmd from administrator and then write
NET USER fwh fwh /add
it execute and create a user called fwh with password fwh
Code: Select all | Expand
#include "fivewin.ch"
Function test()
local cText := ""
local cUser:="Pon2021"
local cPassword:="Pon"
cText += " NET USER " +cUser +" "+;
cPassword +" /add " +;
" /comment='Pon 2021'" +;
" /expires:never " +;
" /passwordchg:No" +;
" /logonpasswordchg:No"
memowrit("test.bat", cText )
waitrun( "test.bat", 0 )
return nil
this created the file .bat
then it is no executed why ?
if you run cmd from administrator and then write
NET USER fwh fwh /add
it execute and create a user called fwh with password fwh
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- Otto
- Posts: 6403
- Joined: Fri Oct 07, 2005 7:07 pm
- Has thanked: 24 times
- Been thanked: 2 times
- Contact:
Re: run a batch file from fwh
Hello Silvio,
Do you run your EXE as admin?
I use the same code as you with no problems.
Best regards,
Otto
Do you run your EXE as admin?
I use the same code as you with no problems.
Best regards,
Otto
Code: Select all | Expand
if lIsDir( cVerzeichnis ) = .f.
lMKDir( cVerzeichnis )
cText := 'net user ' + cUser + ' ' + cPW + ' /add /comment:"Basic WINHOTEL Remotedesktop user account." /fullname:"' + cfullname +'" /logonpasswordchg:no' + CRLF
cText := cText + 'net localgroup "Remotedesktopbenutzer" '+ cUser +' /add' + CRLF
cText := cText + 'net localgroup "Benutzer" ' + cUser + ' /delete' + CRLF
cText := cText + 'WMIC USERACCOUNT WHERE "Name=' + "'" + cUser + "'" + '" SET PasswordExpires=FALSE' + CRLF
memowrit( ".\psfiles\ps_8.bat", cText )
waitrun( ".\psfiles\ps_8.bat" )
endif
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
- Silvio.Falconi
- Posts: 7133
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: run a batch file from fwh
Otto wrote:Hello Silvio,
Do you run your EXE as admin?
I use the same code as you with no problems.
Best regards,
OttoCode: Select all | Expand
if lIsDir( cVerzeichnis ) = .f.
lMKDir( cVerzeichnis )
cText := 'net user ' + cUser + ' ' + cPW + ' /add /comment:"Basic WINHOTEL Remotedesktop user account." /fullname:"' + cfullname +'" /logonpasswordchg:no' + CRLF
cText := cText + 'net localgroup "Remotedesktopbenutzer" '+ cUser +' /add' + CRLF
cText := cText + 'net localgroup "Benutzer" ' + cUser + ' /delete' + CRLF
cText := cText + 'WMIC USERACCOUNT WHERE "Name=' + "'" + cUser + "'" + '" SET PasswordExpires=FALSE' + CRLF
memowrit( ".\psfiles\ps_8.bat", cText )
waitrun( ".\psfiles\ps_8.bat" )
endif
thanks Otto
I thought that I could directly load test.bat an exe program and load it in administrator mode,
now I have to remember to load the exe in administrator mode
a question
what do you do with the command
Code: Select all | Expand
'WMIC USERACCOUNT WHERE
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- Otto
- Posts: 6403
- Joined: Fri Oct 07, 2005 7:07 pm
- Has thanked: 24 times
- Been thanked: 2 times
- Contact:
Re: run a batch file from fwh
Silvio, WINDOWS is a very save OS.
Best regards,
Otto
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
Re: run a batch file from fwh
Silvio,
Why don't you make a LNK-file (like shortcut) in which you can define to run it as an administrator.
In your application you use the
WaitRun("XXXX.LNK,0)
Doesn't that work?
Why don't you make a LNK-file (like shortcut) in which you can define to run it as an administrator.
In your application you use the
WaitRun("XXXX.LNK,0)
Doesn't that work?
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.09 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.09 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
- Silvio.Falconi
- Posts: 7133
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: run a batch file from fwh
driessen wrote:Silvio,
Why don't you make a LNK-file (like shortcut) in which you can define to run it as an administrator.
In your application you use the
WaitRun("XXXX.LNK,0)
Doesn't that work?
I have at my school 3 labs with 22 computer each I wish to find a faster way to create user accounts for students
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com