如何从远程系统运行批处理文件 [英] How to Run a Batch file from Remote system

查看:90
本文介绍了如何从远程系统运行批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有2个SQL脚本说1.sql和2.sql。我想使用批处理文件来检查注册表中的应用程序版本。然后根据条件



Hi,

I have 2 SQL script say 1.sql and 2.sql . I want to use a Batch file to fist check the registry for the application version. Then based on the condition

If version = 1.0.0040
  Run 2.sql
Else
  Run both 1.sql and 2.sql



1.sql创建数据库和其他一些对象

2.sql修改一些对象



注册表项应该检查我的本地系统,数据库在网络上的远程机器上。



请帮助....



从下面的评论中复制的其他信息

这是我可以提出的脚本但是PRoductVersion应该有注册表值以便我可以比较


1.sql creates Database and some other objects
2.sql modifies some objects

the Registry entry should be check on my local system,and the Database is on a remote machine on the network.

Please Help ....

additional information copied from comment below
This is the script I could come up with but PRoductVersion should have the registry value so that I can compare

@echo off

ECHO Enter Login User Details:
SET /P USER=User Name e.g. (DomainName\DomainUserName) [sa]: 
IF "%USER%"=="" SET USER="sa"
Echo Setting UserName to : %USER%

SET /P PWD=Password :

SET /P ProductVersion = ....................

IF ProductVersion = 1.0.0040 (

echo ..........................
echo Starting database creation
echo ..........................

sqlcmd -dSATDB -iSAT11_SQLscript.sql -ocreate_databases_log.txt

)

Else (

echo ..........................
echo Starting folder creation
echo ..........................

mkdir "D:\SAT\DATA"
mkdir "D:\SAT\BACKUP"

echo ..........................
echo Starting database creation
echo ..........................

sqlcmd -dSATDB -iSAT10_SQLscript.sql -ocreate_databases_log.txt
sqlcmd -dSATDB -iSAT11_SQLscript.sql -ocreate_databases_log.txt

)

GO
echo end of database creation

pause

推荐答案

您还可以使用pushd< remote folder =>映射远程文件夹。当你用popd结束时取消映射。
you can also map your remote folder with pushd <remote folder=""> and unmap it when you finish with popd.


这篇关于如何从远程系统运行批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆