Visual foxpro替换命令/ CMD

时间:2015-10-16 08:10:36

标签: foxpro

我想在foxpro中创建一个程序,您可以在文本框中键入名称,它会在命令提示符下自动添加用户。所以netuser(名称)和一个按钮(添加用户) 问候

克里斯

2 个答案:

答案 0 :(得分:1)

* Does the initial setting for foxpro
*
set echo off
set talk off
set step off
set date british
set century on
set intensity off
set delimiter on
set delimiter to '[]'
set scoreboard off
set menu off
set safety off
set deleted on
set escape on
set device to screen
set color to
set exclusive on
set status on
set bell off
clear all
clear program
clear
*
** define a variable to store user name to be created

muser_name = space(20) 
@ 12, 22 say 'Enter User Name ' get muser_name
read
if !empty(muser_name)
   * this command adds a new user to the computer
   run net user &muser_name /add
endif
wait
clear
clear program
return
**
* end of program

这将为您的计算机创建一个没有任何密码的新用户。

答案 1 :(得分:0)

我认为你应该看看Powershell而不是Visual Foxpro。 如果您使用的是Foxpro 2.6(不是Visual版本),则可以使用Accept命令:

DO WHILE .t.
   ACCEPT "Enter username:" to mUser
   IF len(trim(mUser)) = 0
       exit
   ENDIF
   run net user &mUser /add
ENDDO